1 僞類選擇器
條件一:根據元素不同的狀態,自動選擇不同的樣式
first-child
a:hover鼠標劃過的時候添加樣式
a:active鼠標點擊的時候添加樣式,
a:link鏈接地址未被訪問時候添加,必須設置href屬性
a:visite鏈接地址已經被訪問的時候添加樣式,必須設置href屬性
<style type="text/css">
a{
text-decoration:none;
}
/* a:hover{
text-decoration: underline;
font-size: 30px;
}*/
/* a:active{
color: yellow;
}*/
/*a:link{
color: yellow;
}*/
/* a:visited{
color: gray;
}*/
</style>
</head>
<body>
<a href="http://www.huadianedu99999.com/"target="_blank">華點軟件學院</a>
</body>
input:focus鼠標點擊輸入框,背景顏色會變化。
input:focus{
background-color: #3695ff;
}
<input tyoe="text">
2 僞元素選擇器
需要設置特殊效果的內容放到一個元素(標籤)裏面
first-letter,選擇第一個元素
first-line,選擇第一行
before,在之前添加內容
after,在之後添加內容
li:after{
content:'。';
}