Reputation: 7028
How can you specify link attributes inside a class in main.css.
The standard link attribute is fine when put in a non defined area of the CSS file.
a:link { color:white }
However if I want to create a class so that I am only defining how the attributes apply to a menu it errors as a syntax error. For example.
menuLinks {
a:link { color:white }
}
Will show as an error, so how can I define link attributes within a class. I am using visual web developer 2010
Upvotes: 1
Views: 124
Reputation: 19953
You cannot "nest" brace blocks.
Assuming menuLinks
is the id
of the object, use this...
#menuLinks a:link { color:white; }
If menuLinks
is the class
of the object, use this...
.menuLinks a:link { color:white; }
UPDATE based on comments...
Instead of having the individual blocks like this...
#Menu a:link { color:white; }
#Menu a:link { text-decoration:none; }
You can combine them into a single block...
#Menu a:link { color:white; text-decoration:none; }
Which can also be written like this which can be easier to read, depending on how many items you have...
#Menu a:link {
color:white;
text-decoration:none;
}
Upvotes: 2
Reputation: 943097
Use a descendent selector
menuLinks a:link {}
Note that:
menuLinks
will match <menuLinks>
which is not valid HTMLUpvotes: 1