樣式
<style>
注釋
/**/
選擇所有元素
*
外邊距/內(nèi)邊距
margin/padding(-top/right/left)
通過外邊距居中,左右距根據(jù)網(wǎng)頁自動(dòng)調(diào)整
margin: ?0 auto 0 auto(上右下左)
行高
line-height——使行高等于樣式高實(shí)現(xiàn)垂直方向的居中
水平居中
text-align: center
文字粗細(xì)
font-weight: bold(加粗)
內(nèi)容靠左浮動(dòng)
float:left
去除無序列表各元素前綴點(diǎn)
list-style-type: none
去除超鏈接下默認(rèn)下劃線
text-decoration: none
已瀏覽超鏈接
visited
超鏈接
link
邊框圓角(5像素)
border-radius: 5px
背景顏色
background-color
選取標(biāo)簽
.
旋轉(zhuǎn)(角度)
transform: rotate(n deg)
鼠標(biāo)移入效果
.hover
動(dòng)畫時(shí)長
transition: 1s
動(dòng)畫延遲
ease-out 0.3s
高度(height/width/top/bottom均可以百分比表示炕横,百分比為相對父元素)
height: 100% ? ? ? 表該數(shù)值為父元素?cái)?shù)值的100%讶隐;width同理,但body集寬度默認(rèn)即為瀏覽器的100%咕晋。
相對位置
position: relative
絕對位置
position: absolute
實(shí)線/虛線
solid/dashed
把邊框和內(nèi)邊距放入框中
box-sizing=“border-box”
超出部分不顯示
overflow:hidden
將盒子背景換為圖片
background-image: url("圖名")
設(shè)置背景占盒子面積比(水平比/垂直比)
background-size: 100% 100%
景深
perspective:
設(shè)置3D屬性,實(shí)現(xiàn)真實(shí)的3D效果
transform-style:preserve-3d;
繞Y軸旋轉(zhuǎn)角度,向Z軸移動(dòng)
transform:rotateY(
40deg) translateZ(450px)
定制動(dòng)畫 form初始狀態(tài) to結(jié)束狀態(tài)
@keyframes a{
? ? ? ? ? ? ? ? ? ? ? ? ? ? form{
transform:rotateY(0deg);} ? ? ? ? ? ???to {transform:rotateY(-360deg);}
調(diào)用定制動(dòng)畫蜈项,時(shí)長40秒,勻速運(yùn)動(dòng)续挟,無限
animation:a
40s linear infinite
選擇器紧卒,空格表后代元素
.toubu??.nav??img