开发者

CSS properties, decorating a link

开发者 https://www.devze.com 2023-03-23 09:44 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消