开发者

css/javascript selected link style

开发者 https://www.devze.com 2023-02-22 12:21 出处:网络
i have some links that are surrended by some borders. on hover, the links are made white. my code: #product_unavailable_types a:hover {

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

精彩评论

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

关注公众号