Is span the only way to do this?

K

KiwiBrian

If I have some text strings on a page, e.g. headings, or paragraphs, and I
want them to have a background colour behind just the text, is use of the
span tag surrounding/enclosing the text the only way of achieving this?
Of course I would want it to adjust to any client resizing of the text, or
if characters were added or removed in the source.
I was surprised to find that paragraphs are the width of their container and
not the width of the text string, but no doubt there is a good reason for
this.

TIA
Brian Tozer
 
M

mscir

KiwiBrian said:
If I have some text strings on a page, e.g. headings, or paragraphs, and I
want them to have a background colour behind just the text, is use of the
span tag surrounding/enclosing the text the only way of achieving this?
Of course I would want it to adjust to any client resizing of the text, or
if characters were added or removed in the source. ....
TIA
Brian Tozer

Try applying a background-color to the various page elements, or a span.
Using a span for inline text is probably the easiest way to do what you
want.

http://www.blooberry.com/indexdot/css/properties/colorbg/bgcolor.htm
http://www.codeave.com/css/code.asp?u_log=4007
http://www.w3schools.com/css/tryit.asp?filename=trycss_text_background

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top