1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

NOOB Question

Discussion in 'CSS' started by whileloop, Jun 19, 2013.

  1. #1
    #menu is only supposed to apply to <ul id="menu"> but somehow it applies to all the <ul> tags. Why does it happen and how can I fix this? Thank you.

    html:
    Code (Text):
    1. <!doctype html>
    2. <html>
    3. <head>
    4.     <meta charset="utf-8">
    5.     <link rel="stylesheet" href="css/day16.css">
    6. </head>
    7. <body>
    8.     <ul id="menu">
    9.         <li><a href="#">Home</a></li>
    10.         <li><a href="#">About</a></li>
    11.         <li><a href="#">Portfolio</a></li>
    12.         <li><a href="#">Contact</a></li>
    13.     </ul>
    14.     <form action="" method="post">
    15.         <ul>
    16.             <li>
    17.                 <label for="name">Enter Your Name: </label>
    18.                 <input id="name" name="name" />
    19.             </li>
    20.        
    21.             <li>
    22.                 <label for="comments">Your Comments: </label>
    23.                 <textarea id="comments" name="comments"></textarea>
    24.             </li>
    25.         </ul>
    26.         <p><input type="submit" value="Go!" /></p>
    27.     </form>
    28.     <ul>
    29.         <li>Hello</li>
    30.         <li>Item2</li>
    31.         <li>Item3</li>
    32.     </ul>
    33. </body>
    34. <html>
    CSS:
    Code (Text):
    1.  
    2. body {font-family: sans-serif;}
    3. li {
    4.   display: inline;
    5.   padding-right:10px;
    6. }
    7.  
    8. #menu {
    9.   text-decoration: none;
    10.   color: blue;
    11. }
    12.  
    13. #menu a:hover {
    14.   text-decoration: underline;
    15.   color: green;
    16. }
    17.  
    Solved! View solution.
    whileloop, Jun 19, 2013 IP
  2. ActiveFrost

    ActiveFrost Well-Known Member

    Messages:
    2,062
    Likes Received:
    61
    Best Answers:
    3
    Trophy Points:
    150
    #2
    Works just fine for me. What makes you think there's something wrong with it?
    ActiveFrost, Jun 19, 2013 IP
  3. #3
    Uhm, did you only want to target the LI inside #menu? That's the only thing I'm seeing that's targeting everything... if so, change that to "#menu li {" instead of just "li {"

    Though I'm stuck wondering what the blue devil makes LABELs and INPUTs a list?!? Much less what the devil makes a lone INPUT[submit] a paragraph of flow text... bad semantics is worse than no semantics.
    deathshadow, Jun 19, 2013 IP
  4. kk5st

    kk5st Well-Known Member

    Messages:
    2,906
    Likes Received:
    191
    Best Answers:
    9
    Trophy Points:
    190
    #4
    Perhaps because he hasn't used a fieldset wrapper, and an unadorned button is invalid.
    kk5st, Jun 19, 2013 IP
  5. learnwebsitedesigncom

    learnwebsitedesigncom Member

    Messages:
    176
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    28
    #5
    The styles are working as they should when I try them.
    learnwebsitedesigncom, Jun 19, 2013 IP