Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By anner on
I'm trying to add row shading to my theme. If I add
tr.odd td, tr.even td {
background-color: #eee;
padding: 0.3em;
}
No effect. If I put this directly on the page:
<tr style='background-color:#eee;'><td style='background-color:#eee;'>cell conents</td><td style='background-color:#eee;'>cell conents</td></tr>
No effect.
Isn't specifying "sytle=" directly in the page supposed to override any style sheet included? How could this have no effect. I'm completely baffled. Any help is much appreciated.
Comments
Try using !important to test things
In your first example it looks like you are shading odd AND even rows with the same background color. Are you trying to alternate?
To find out if your style is being overridden by some other style, change your td tags to
style="background-color:#eee !important;"
If that STILL doesn't work, you have a more complicated issue.
Still stuck
I was alternating, I was labeling my odd rows, but not my even. So one should have been shaded and not the other. Your example here didn't work either. The attempt is much appreciated.
I don't understand why. All other style elements are working fine. Even table header background color and tr borders and padding. Ideas?
Let's see the HTML...
Can you post a snippet of the code that's being rendered in the browser? Maybe the whole table?
Here are some examples of
Here are some examples of the source it produces:
If I use style='background-color:#eee !important;'
or if I use class='odd'
Nothing seems to make a difference to how it is shown.
Hmm - I pasted
Hmm - I pasted style="background-color: rgb(238, 238, 238) ! important;" into a td tag and it worked fine. Want to email me your stylesheet and HTML?
ARG! You say that and I
ARG! You say that and I think....hmmm, let me check something....it works on windows, but not on my firefox under linux (which is what my desktop is). Dang!
Jeez, and it appears to be only my firefox...the other linux desktops here running both firefox 1 and 2 are fine. Not my day. Thank you so much for your help.
Good luck!
You're welcome - maybe you have some strange settings in your browser? Or even your screen? I want to know the answer! :)
Maybe the tds?
Maybe it's the tds in there causing the problem? This is what I have and it works:
Michelle
--------------------------------------
My site: http://shellmultimedia.com
I tried that in the code
I tried that in the code above, same results.