0

I'm experiencing problems with formatting links on HTML. I have a link, defined like so:

<a href="#a1" class="scroll type1">Some text</a>

As you can see, the link has two classes. The scroll class has no formatting whatsoever: it is just a marker for some lines of javascript code to scroll the page when the link is clicked. The type1 class has css formatting. Here it is:

a.type1:link, a.type1:visited {
    color: #000000;
    text-decoration: none;
}
a.type1:hover {
    color: #4f8dd5;
    text-decoration: none;
}
a.type1:active {
    color: #000000;
    text-decoration: none;
}

So I expect the text of the link to be black, unless the user has the mouse over it, in which case it's blue.

However, that's not what happens. The hover is still correct, but this is what I see without the hover:

enter image description here

For some reason, the formatting in the css file is being ignored, and the default for links is being used.

Normal formatting only works if a.type1:hover is before everything else, but then that formatting isn't applied on hover.

4
  • 2
    Works fine here - jsfiddle.net/gzdux. Your problem is elsewhere. Commented Jun 10, 2013 at 9:56
  • Works fine, something else is messing up your party! Commented Jun 10, 2013 at 9:58
  • Yes. Check for errors like a missing } above this chunk. Commented Jun 10, 2013 at 10:00
  • @Zenith Yes, it has to be! I couldn't figure out what was wrong with this, plus I have more type_x links which work perfectly. But I can't see any problem anywhere... I've tried on other html pages and the same happens Commented Jun 10, 2013 at 10:02

1 Answer 1

1

I'm sorry everyone... A stupid comment line was messing everything up. But like all good computers, I was ignoring that comment. Everything is perfect now. (Damn! I was around and around this for so much time just because of a comment on the css file...)

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

Comments

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.