僞類用單冒號javascript
咱們平時熟悉的a:link、a:visited、a:hover和a : activecss
僞元素用雙冒號(爲了更好的兼容咱們也用單冒號)java
經常使用的:before :after和 :first-line :first-letter ::selectionwordpress
先看三篇博客:.net
http://blog.dimpurr.com/css-before-after/orm
http://blog.jobbole.com/49173/blog
<style>
div{
width:98px;height:48px;
border:2px solid red;
border-bottom:48px solid red;
border-radius:50%;
position:relative;
// transition:2s all ease;
}
div:before{
content:"";
position:absolute;
width:8px;height:8px;
background:#fff;
border:20px solid red;
left:0;top:50%;
border-radius:50%;
}
div:after{
content:"";
position:absolute;
width:8px;height:8px;
background:red;
border:21px solid #fff;
right:0;top:50%;
border-radius:50%;
}
</style>
<script>
window.onload=function () {
var div=document.getElementsByTagName("div")[0];
div.onmouseover=function () {
div.style.transform="rotate(180deg)";
}
div.onmouseout=function () {
div.style.transform="rotate(0deg)";
}
}
</script>
<body>
<div>
</div>
</body>seo
2.http://www.jb51.net/article/81984.htmip
3.http://chitanda.me/2015/07/15/get-and-modify-pseudo-elements-value-by-javascript/