|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I want to set the table row background color (bgcolor) with CSS. What is wrong with my code?
Code:
td.blogtitle { bgcolor: 0000ff; }
...
<td class="blogtitle">
Code:
td.blogtitle { color: 0000ff; }
...
<td class="blogtitle">
|
|
#2
|
||||
|
||||
|
td.blogtitle { background: 0000ff; }
I don't think bgcolor does anything in css, and color sets font color. |
|
#3
|
|||
|
|||
|
Quote:
|
|
#4
|
||||
|
||||
|
remember to use the "#" when using hexadecimal notation,
ie. background:#0000ff; |
|
#5
|
|||
|
|||
|
Quote:
|
|
#6
|
||||
|
||||
|
the use of # is to define that the color attributes you are using are in hexadecimal form
http://www.w3.org/TR/REC-CSS2/syndata.html#color-units in xhtml you always have to quote the attributes you are using, http://www.w3.org/TR/xhtml1/#h-4.4 |
|
#7
|
|||
|
|||
|
If you look at http://www.w3.org/TR/REC-CSS2/syndata.html#color-units you will see that there is not other possible interpretation if you do not use the "#" sign... so most browsers probably default to the proper hexadecimal parsing.
|
|
#8
|
|||
|
|||
|
Check this out about empty elements:
http://www.w3.org/TR/xhtml1/#guidelines Quote:
|
|
#9
|
||||
|
||||
|
Quote:
but you can't be sure of that so, therefor one should always specify. its just the same as setting width:100; to an element, some browsers might parces that as 100px, but most wont (as they should) so you can't always relay on the browsers, |
|
#10
|
||||
|
||||
|
But guidelines are created so that you obey them - and if you want to produce clean code I think you should obey them. Even if nobody else does
I see this just as a work that I do to make my code easier to read and understand. I understand it if you don't know that guidelines that you then wouldn't obey them. But as you know them you should use them. And it isn't to hard to add a # or a / - or? At least I try to add them where necessary as long as I remember it ![]() |
|
#11
|
|||
|
|||
|
setting the background color of a table row
I was interested in the response to the person who wanted to set the background color of a table row. To my way of thinking however the response only applied to setting the background color of an individual cell.
What is the syntax for setting the color for the whole row without dealing with each cell individually I tried the following without success tr.special {background #000080;} <tr class="special"> Can someone help me out? |
|
#12
|
||||
|
||||
|
Make sure you have a colon between background and your color:
{background: #000080;} |
|
#13
|
|||
|
|||
|
Re: setting the background color of a table row
Quote:
|
|
#14
|
|||
|
|||
|
Akh and fgeller, I agree. I am going to go add "#" to all my colors and start quoting variable initializations. It does make sense to stick with what you know is proper.
|
|
#15
|
|||
|
|||
|
Re: Re: setting the background color of a table row
Quote:
Thanks for the reply. However I still couldnt get it to work so I decided to just use just straight html <tr bgcolor="#000080"> |