CSS properties, decorating a link
My CSS contains
a.myLink {
hover {font-size: 24;
fo开发者_高级运维nt-weight: bold;
color: red;
}
I'd like to be able to reference it using
<a class="myLink" href="http://myUrl" target='_new'>myName</a>
However, CSS does not get recognize this call.
What am I missing here? Please advise.
a.myLink {
hover {font-size: 24;
Is not correct syntax, look at using
Link Properties:
a.myLink {
/* Some formatting for the link here */
}
Hover Properties:
a.myLink:hover {
font-size: 24;
font-weight: bold;
color: red;
}
You need
a.myLink:hover {
font-size: 24;
font-weight: bold;
color: red;
}
if you want to add these styles when someone hovers over the link.
You shouldn't have any asteriks(*) in your HTML code. Maybe you only added those for this demonstration?
But for a hover effect you want something like this:
a.myLink:hover { /*code here */ }
just a bit of mixed up syntax.
精彩评论