View Full Version : Text Formatting

Oct 21st, 2008, 01:30 AM

This sounds really simple, but for some reason I can't get it to work. I have a block of text inside a DIV. That works fine. Now within this block of text I want to change the colour of a few words. I can do this with another DIV but it adds a return (like a BR was typed) so the text appears on the next line. I don't want that, just want to change the colour on some text. Can someone help?


Oct 21st, 2008, 01:37 AM
apply css inline display in the div

<div style='display:inline;color:dodgerblue'>ipsum</div> dolor....

Oct 21st, 2008, 01:47 AM
awesome thanks!

Oct 21st, 2008, 04:44 AM
You should really use a span, as it's an inline element already and a div is block.

Lorem<span style='color:dodgerblue'>ipsum</span> dolor....

Or if the different colour was always going to be the same you could just do:

Lorem<span>ipsum</span> dolor....

And then make a CSS rule like:

div span {

Or if reusing a series of colours then give the span a class and set the different classes. :)