css中的僞類和僞元素

僞類用單冒號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://www.zhangxinxu.com/wordpress/2010/09/after%E4%BC%AA%E7%B1%BBcontent%E5%86%85%E5%AE%B9%E7%94%9F%E6%88%90%E5%B8%B8%E8%A7%81%E5%BA%94%E7%94%A8%E4%B8%BE%E4%BE%8B/htm

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/

相關文章
相關標籤/搜索