开发者

css/javascript selected link style

i have some links that are surrended by some borders. on hover, the links are made white. my code:

#product_unavailable_types a:hover {

border-color: #fff;

}

i would like that those borders will remain white after the selection also. i mean, if i click on that lin开发者_如何学Ck, the borders will stay with the above style. and i have no idea how to do it.

any clue?

thank you!


You are searching for the a:visited pseudo class.

That means:

#product_unavailable_types a:hover, #product_unavailable_types a:visited {
    border-color: #fff;
}

EDIT

If the link doesn't lead you to another page, try to put this in the head element:

<script type="text/javascript">

    function highlight(link) {

        link.style.borderColor = '#fff';

    }

</script>

Then, add the onclick attribute to your a element, so that it looks like:

<a href="#test" onclick="highlight(this);">test</a>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜