views:

30

answers:

1

Here's the HTML:

<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;

<html xmlns="http://www.w3.org/1999/xhtml"&gt;

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<title>Hi World!</title>

<link rel="stylesheet" type="text/css" href="c/main.css?95" />

</head>
<body>
<div id="wrapper">
  <div id="divider">
  <h1>LOGO</h1>
  <ul class="underlinemenu">
    <li>menu item</li> 
    <li>menu item</li>
    <li>menu item</li> 
    <li>menu item</li>
    <li>menu item</li> 
    <li>menu item</li>
  </ul>
  </div> <!-- end divider -->

  <div id="divider">
  <div class="article">
    <h2 class="header">HEADER</h2>
    <div class="content">
      <p>CONTENT CONTENT CONTENT</p>
      <p>CONTENT CONTENT CONTENT</p>
      <p>CONTENT CONTENT CONTENT</p>
    </div>
  </div>
  </div> <!-- end divider -->

  <div id="divider">
  <div class="article">
    <h2 class="header">HEADER</h2>
    <div class="content">
      <p>CONTENT CONTENT CONTENT</p>
      <p>CONTENT CONTENT CONTENT</p>
      <p>CONTENT CONTENT CONTENT</p>
    </div>
  </div>
  </div> <!-- end divider -->

  <div id="divider">
  <div class="article">
    <h2 class="header">HEADER</h2>
    <div class="content">
      <p>CONTENT CONTENT CONTENT</p>
      <p>CONTENT CONTENT CONTENT</p>
      <p>CONTENT CONTENT CONTENT</p>
    </div>
  </div>
  </div> <!-- end divider -->

  <div id="footer">
    <p class="copyright">COPYRIGHT</p>
    <ul id="sitemap">
      <li>menu item</li>
      <li>menu item</li>
      <li>menu item</li>
      <li>menu item</li>
    </ul>
  </div>
</div> <!-- end wrapper -->
</body>
</html>

And here's my CSS:

/* LAYOUT */
/* ----------------------------------------- */

div#wrapper {
    margin: 0 auto;
    width: 936px;
}

div#divider {
    border-bottom: 1px dotted #c5c5c5;
    margin: 0 0 10px 0;
    padding: 0 0 10px 0;
}
/*Credits: Dynamic Drive CSS Library */
/*URL: http://www.dynamicdrive.com/style/ */

.underlinemenu{
font-weight: bold;
width: 100%;
}

.underlinemenu ul{
padding: 6px 0 7px 0; /*6px should equal top padding of "ul li a" below, 7px should equal bottom padding + bottom border of "ul li a" below*/
margin: 0;
text-align: right; //set value to "left", "center", or "right"*/
}

.underlinemenu ul li{
display: inline;
}

.underlinemenu ul li a{
color: #494949;
padding: 6px 3px 4px 3px; /*top padding is 6px, bottom padding is 4px*/
margin-right: 20px; /*spacing between each menu link*/
text-decoration: none;
border-bottom: 3px solid gray; /*bottom border is 3px*/
}

.underlinemenu ul li a:hover, .underlinemenu ul li a.selected{
border-bottom-color: black;
}

What am I doing wrong?

+3  A: 

You've got your CSS selectors one level wrong. Your rules should be:

ul.underlinemenu {
   // rules that will target the <ul>
}

ul.underlinemenu li {
   // rules that will target the nested <li>'s
}

ul.underlinemenu li a {
   // rules that will target the nested <a>'s
}

The reason for this is because you're trying to style a <ul> with class underlinemenu. What you have is trying to style a <ul> that is nested inside another element with class underlinemenu.

Pat
Makes sense, thanks Pat! .underlinemenu{font-weight: bold;width: 100%;} should remain the same though, right?
MW2000
Yep, that rule will select any element with a class of `underlinemenu`. If you wanted, you could combine it with your `ul.underlinemenu` rules to help keep your CSS organized.
Pat