Forum Moderators: not2easy

Message Too Old, No Replies

highlighting text with css

         

sneaks

6:00 am on Jul 10, 2007 (gmt 0)

10+ Year Member



to put this as simple as i can:
i want to apply a background colour to paragraph text much like if it was highlighted, except the background color always runs to the end of the block of text.

Is there a method so that there is a staggered type effect and each line ends at the end of the text of that line instead of being flush with the rest of the lines? muych like if you drag and selected this text.

thanks
jd

[edited by: sneaks at 6:04 am (utc) on July 10, 2007]

Marshall

6:03 am on Jul 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Instead of applying the background-color to the <p>, apply it to a <span>:

<p><span style="background-color:#0f0;>Your text here.</span></p>

This should solve the block problem and keep the color to the shape of the text.

Marshall

sneaks

6:06 am on Jul 10, 2007 (gmt 0)

10+ Year Member



oh man i should have known that! thanks all the same!

jd

Marshall

6:16 am on Jul 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Don't feel bad. I think 99% of the time we all miss the obvious or the things we should know. I did it yeaterday on an xml:sort function for four hours - Dooh!

Marshall

lavazza

6:21 am on Jul 10, 2007 (gmt 0)

10+ Year Member



inline

lavazza

6:23 am on Jul 10, 2007 (gmt 0)

10+ Year Member



<p> is block level
<span> is an inline

you can apply classes with display:inline to block level elements