1
a {
    color: #000;
}

a:hover {
    text-decoration: none;
    color: #fff;
}

That is the code I use. But, none of the links I have in my pages listen to this. They abide by this instead:

#menu li, a {
    text-align: center;
    display: block;
    float: left;
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size:1.2em;
    color: #575757;
    text-decoration: none;
    list-style: none;
}

Therefore a lot of the links are skewed, as they all float left and things.
The code for the links itself isn't wrapped in any way. At least not in a way that explains my errors.

<div id="footer">
  <p><center>Copyright 2008 - <a href="index.php">G.S.B.V. Pugilice</a></center></p>
</div>

That bit of code gives me two lines instead of one, the link floats left on the second line.

1 Answer 1

8

I think you may be mis-understanding how selectors work.

#menu li, a { ... }

Means apply styles to any li descendant of a element with the id #menu and to any a found any where.

Did you actually intend:-

#menu li, #menu a {...}

?

Sign up to request clarification or add additional context in comments.

3 Comments

I get the feeling that's exactly what he meant, especially given that the id is "menu". I think if you do what AnthonyWJones suggested you should find it behaving as you are intending.
Could I use the following: #menu li a {...}, without the comma after li? So that only links in the menu, within an li tag are selected?
Yes, that will select only the links in the list item.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.