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的更多相关文章

  1. [CSS] :not Selector

    The CSS :not() selector allows us to exclude a subset of elements matched by our selector. In this e ...

  2. CSS3 & CSS var & :root

    CSS3 & CSS var & :root How to change CSS :root color variables in JavaScript https://stackov ...

  3. 巧用CSS3:target 伪类制作Dropdown下拉菜单(无JS)

    原文链接:http://devework.com/css3-target-dropdown.html :target 是CSS3 中新增的一个伪类,用以匹配当前页面的URI中某个标志符的目标元素(比如 ...

  4. [CSS] Target empty elements using the :empty pseudo-class

    You can target an element that has no child elements by using the :empty pseudo-class. With browser ...

  5. [CSS3] CSS Media Queries

    Using CSS media queries allows you to design responsive layout in your web apps and website. We will ...

  6. [CSS3] CSS Display Property: Block, Inline-Block, and Inline

    Understanding the most common CSS display types of block, inline-block, and inline will allow you to ...

  7. css :target

    花了半小时在找如果完成:target的问题 需求:点击<a href="#Main">Main</a>时,会触发:target 效果 结果在网络上没有找到, ...

  8. [CSS3] CSS Background Images

    Body with background image and gradient html { background: linear-gradient(#000, white) no-repeat; h ...

  9. [CSS] Target Positional Elements Using *-Of-Type CSS pseudo-classes

    Learn how to target elements based on their position inside of a parent element in relation to its s ...

随机推荐

  1. ICE学习第二步-----从第一个程序了解ICE(HelloWorld)

    ICE(Internet Communications Engine)是一种面向对象的中间件平台,主要用于网络通讯.它为面向对象的“客户端-服务器”模型的应用提供了一组很好的工具和API接口.目前在全 ...

  2. %s的用法

    %s 正常输出字符串printf("%s\n", "abcd"); //normal output abcd %8s 最少输出8位长度的字符串,不够在字符串左侧 ...

  3. 支付宝集成获取私钥与公钥-b

    项目需要,需要在客户端集成支付宝接口.就研究了一下:因为使用支付宝接口,就需要到支付宝官网:注册帐号,并申请.下面讲的是申请好之后的操作.登录成功之后,   店家我的商家服务—在页面的下方找到——&g ...

  4. Popular Deep Learning Tools – a review

    Popular Deep Learning Tools – a review Deep Learning is the hottest trend now in AI and Machine Lear ...

  5. nosql数据库选型

    http://blogread.cn/it/article/6654 今天在书店里翻完了一遍<七天七数据库>.这本书简单介绍了postgreSQL,riak,mongodb,HBase,r ...

  6. Building a Space Station

    poj2031:http://poj.org/problem?id=2031 题意:就是给出三维坐标系上的一些球的球心坐标和其半径,搭建通路,使得他们能够相互连通.如果两个球有重叠的部分则算为已连通, ...

  7. cf E. George and Cards

    http://codeforces.com/contest/387/problem/E 题意:给你n个数,然后在输入k个数,这k个数都在n个数中出现,进行每一次操作就是在n个数中选择长度为w的连续序列 ...

  8. 【POJ】3283 Card Hands

    字典树. #include <iostream> #include <cstdio> #include <cstring> #include <string& ...

  9. Windows下Vundle插件BundleSearch命令出现错误解决方案

    纯粹参考他人博文,已证明解决方案正确,转载时请注明参考链接!!! 参考链接: http://www.tuicool.com/articles/e2aiEn 在Windows下使用Vim时,用Vundl ...

  10. C++中强制变换之const_cast

    今天学习了一下C++中的强制转换,看了const_cast,我发现了这个转换关键字的奇怪之处,于是把它记录一下,废话不说,先看一个程序: #include <iostream> using ...