Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why isn't this table cell getting the correct class applied?

I have an HTML page (PHP, really) with a table cell that contains a graphic and has two background graphics (one repeating gradient, one right aligned). It has a second table cell that contains a styled list. Because I need to use PHP to evaluate the image path, I need to define certain styles inside the HTML, instead of in a separate .css file. Can anyone help me out and explain why the styles are being correctly applied to the li elements, but not to the table cell with class logoHeader? (li.white is defined in the linked css file, as it doesn't require any php for path evaluation.) I'm a server-side programmer, and although I can do basic css I don't have the greatest grasp on rules of inheritance.

Here's the rendered source:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" >
<head>
 <base href="http://mysite.com/mobile" /> 
 <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
 <title>Home</title> 

 <meta name="viewport" content="width=device-width, initial-scale=1.0"/>  
 <link rel="stylesheet" href="/templates/mobile/css/editor_content.css" type="text/css" />
 <style>
  <!-- need to define these styles here because we can't use php in the css - it doesn't evaluate -->

  td.logoHeader {
   background: url(/images/mobile/transparentLeavesRight.png) top right no-repeat,  
               url(/images/mobile/transparentLeavesGradient.png) top left repeat-x;
               text-align:center;}


  li.blue {
   background-image:url(/images/mobile/arrow.png);
   background-repeat:no-repeat;
   background-position:right; 
   background-color:#013799;
  }
 </style>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td class="logoHeader"><img src="/images/mobile/logoCopy.png" alt="Senior Living" /></td></tr>
<tr><td>
<ul class="pureCssMenu">
    <li class="white">1-800-888-8888 </li>
    <li class="blue"><a href="/about">ABOUT US</a></li>
    <li class="blue"><a href="/care-types">CARE TYPES</a></li>
    <li class="blue"><a href="/find-a-community">FIND A COMMUNITY</a></li>
    <li class="blue"><a href="/programs">PROGRAMS</a></li>
    <li class="blue"><a href="/gallery">VIDEO GALLERY</a></li>
    <li class="blue"><a href="/contact">CONTACT US</a></li>
</ul>
</td></tr>
</table>

</body>
</html>

I've also tried defining the class as just .logoHeader (as opposed to td.logoHeader) - same results. It doesn't get the style. Here's a firebug screenshot showing what it's getting: enter image description here

like image 367
EmmyS Avatar asked Nov 06 '22 03:11

EmmyS


1 Answers

I can apply the styles using that class if I remove your comment in the Style section. CSS comments should be this style: /* Comment */

Edit: added example: http://jsfiddle.net/FMwRr/

like image 53
Graham Conzett Avatar answered Nov 14 '22 21:11

Graham Conzett