Help - Search - Members - Calendar
Full Version: One last question
HTMLHelp Forums > Web Authoring > Cascading Style Sheets
minidiapolis
Hello,

I hope you don't mind one last question. . .

it's my understanding you should put everything in quotes like this:

<p style = "color:blue;
font family: arial">

but how would you do it if you needed to use quotes inside that block of code like
<p style = "background-image:
url()">
Darin McGrew
In this case, I would move the CSS to a style sheet and use a CLASS or ID attribute rather than the STYLE attribute.

But in general, you can use character entity references like &quot; or &#34;
pandy
Or you alternate double and single quote pairs.

BTW url() doesn't need quotes. smile.gif
factor
As Darin said the best solution is to use classes, it can be more meaningful if you'd use for eg. <p class="blue">. Use semantic markup whenever you can.
pandy
Except "blue" isn't semantic. tongue.gif
factor
You can interpret my last sentence as a separate advice wink.gif
Darin McGrew
Just to be perfectly clear for the original poster:

<p class="blue"> is a poor example of a CLASS value. It's better to ask why you want the paragraph to be blue, and to use a CLASS value that reflects that meaning.

For example, if you want all brillig paragraphs to be blue, then you could use <p class="brillig">. Later, when you decide to make all your brillig paragraphs green instead, you can change just the style sheet. Otherwise, you'll either need to change all your HTML, or you'll end up in the confusing situation where <p class="blue"> is colored green.
minidiapolis
I really appreciate all your help smile.gif
factor
Thanks Darin to pointing that out, it really makes sense.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.