码迷,mamicode.com
首页 > Web开发 > 详细

[CSS3] CSS :target Selector

时间:2016-05-07 18:01:50      阅读:219      评论:0      收藏:0      [点我收藏+]

标签:

The :target selector allows us to interact with a fragment identifier, or hash, in our URL from CSS.

 

HTML:

<body>
    <a href="#tab1">Tab 1</a><a href="#tab2">Tab 2</a><a href="#tab3">Tab 3</a>
    <div id="tab1" class="tab">
        <h1>Tab 1 Content</h1>
    </div>
    <div id="tab2" class="tab">
        <h1>Tab 2 Content</h1>
    </div>
    <div id="tab3" class="tab">
        <h1>Tab 3 Content</h1>
    </div>
</body>

 

CSS:

    <style>
        .tab{
            display: none;
        }
        .tab:target {
            display: block;
        }
    </style>

 

 

 

[CSS3] CSS :target Selector

标签:

原文地址:http://www.cnblogs.com/Answer1215/p/5468599.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!