I need to place borders around text. All my books and references discuss borders around sections such as <div> and tables, but I cannot find the css logic for borders around text. Can someone help me out or point me in the right direction?
Thanks!
| SitePoint Sponsor |
I need to place borders around text. All my books and references discuss borders around sections such as <div> and tables, but I cannot find the css logic for borders around text. Can someone help me out or point me in the right direction?
Thanks!
Jason from AllThingsPolitics.com





Example:
CSS:
HTML:Code:p span { border: 1px solid green; }
As you can see above, to draw a border around the actual text, it needs to be applied to an inline element (such as <strong>, <a>, or <span>...), or a block-level element (such as <div>, <p>, etc...) which is set to display: inline; through CSS.Code:<p><span>Text Here</span></p>


Note that you will need to add position:relative otherwise ie won't draw the borders correctly.
www.pmob.co.uk CSS FAQ 3 col demo Read My CSS Articles
Ultimate CSS Reference
Check out SitePoint's latest JavaScript challenge
Thanks for the replies. But when I tried this, it put a block border around the entire selection. Instead of "border," I should probably use "outline." I am needing to outline each letter of a selection with the outline following the actual letter itself, not a block around the letter. I am hope I am more clear this time. Can this be done in CSS?
Thanks for your help!
Jason from AllThingsPolitics.com





outline won't be of much help, as it outlines elements as well. There's a property: text-shadow, which would come pretty close, but unfortunately, only Safari supports it to date. An image would probably be more suitable for this effect you're going for anyway.
Ok. Thanks. I appreciate your help!
Jason from AllThingsPolitics.com
Bookmarks