CSS應用二,css應用
如:padding,margin,border,等,都是按照順時針方向賦值的,及上右下左。
Padding:1px 2px 3px 4px;(top:1px;right:2px;bottom:3px;left:4px;)
Border-radius:3px;表示四個角都是3像素的圓角。
Border-radius:3px 4px 5px 6px;四個角的圓角度數都不一樣,左上為:3px;右上為:4px,右下為5px;左下為6px;
我們在樣式中經常看到這樣的寫法:
margin:0 3px;當top和bottom的數值一樣,left和right一樣時,可以這樣簡寫。
Margin: 1px 3px 2px;這樣的寫法為,top的值為1px,bottom的值為2px;left與right的只為:3px;
關於fixed的使用
Position的屬性值。產生絕對位置的元素,相對於瀏覽器視窗進行定位。通過left,right,bottom,left來控制位置。一旦設定位置,就會固定在瀏覽器對應的位置,不會跟隨瀏覽器內容的滾動而滾動。多應用在快顯視窗,提示框等條件下。如:position:fixed;Left20px;top:30px;
Animation為簡寫屬性,用來設定六個動畫屬性:
animation-name 規定需要綁定到選取器的 keyframe 名稱。
animation-duration 規定完成動畫所花費的時間,以秒或毫秒計。
animation-timing-function 規定動畫的速度曲線。
animation-delay 規定在動畫開始之前的延遲。
animation-iteration-count 規定動畫應該播放的次數。
animation-direction 規定是否應該輪流反向播放動畫。
屬性定義為:animation: name duration timing-function delay iteration-count direction;
如:animation:myfirst 5s; 定義一個名為myfirst 的動畫,時間為5s。
@keyframes myfirst
{
from {background:red;}
to {background:yellow;}
} 定義該動畫,的背景由紅邊黃。
animation-timing-function 規定動畫的速度曲線。
曲線包括(
linear:動畫從頭到尾的速度是相同的。
ease:預設。動畫以低速開始,然後加快,在結束前變慢。
ease-in:動畫以低速開始。
ease-out :動畫以低速結束。
ease-in-out:動畫以低速開始和結束。
cubic-bezier(n,n,n,n):在 cubic-bezier 函數中自己的值。可能的值是從 0 到 1 的數值。;)