Css中的樣式

2021-09-09 07:02:53 字數 773 閱讀 1172

下面我們用css樣式來實現一些效果。

hover偽類當滑鼠移到某個元素上面會觸發某個事件發生,如下所示:

當滑鼠移到em元素上時,em會發生背景顏色的變化

.rightbtn a em:hover

我們還可以利用css的樣式來實現一些動畫效果

設定當滑鼠移到某元素上,元素彈出時間不同來實現:當滑鼠移到元素上,元素就會按照不同的時間漸漸淡出,當滑鼠離開元素時,元素就會按照不同的時間漸漸恢復原來的樣式!

.rightbtn:hover a

.rightbtn a:nth-of-type(1)

.rightbtn a:nth-of-type(2)

.rightbtn a:nth-of-type(3)

.rightbtn a:nth-of-type(4)

.rightbtn a:nth-of-type(5)

.rightbtn a:nth-of-type(6)

.rightbtn a:nth-of-type(7)

.rightbtn a:nth-of-type(8)

.rightbtn a:nth-of-type(9)

.rightbtn a:nth-of-type(10)

.rightbtn a:nth-of-type(11)

.rightbtn a:nth-of-type(12)

.rightbtn a:nth-of-type(13)

.rightbtn a:nth-of-type(14)

html中的css樣式

1 css的幾種引入方式 1 內聯式css樣式,是直接寫在html標籤中,如 這裡文字是紅色。注意css樣式 要寫在style 雙引號中,如果有多條css樣式 可以設定在一起,中間用分號分開。這裡文字是紅色。不推薦使用這種方法。2 嵌入式css樣式,寫在當前檔案中 可以把css樣式 寫在 嵌入式cs...

CSS中引入CSS樣式的方法

html宣告標籤 定義和用法 宣告必須是html文件的第一行,位於標籤之前。宣告不是html標籤 他是指示web瀏覽器關於頁面使用哪個html版本進行編寫的指令 在html4.0中,宣告引用dtd,因為html4.01基於sgml。dtd規定了標記語言的則 這樣瀏覽器才能正確的呈現內容。html5不...

CSS中的字型樣式和文字樣式

在手機端設定大小的時候,一般不使用px css字型顏色三種表達方式 1.具體顏色名稱例 color red 2.數字 0 255,百分比 0 100 例 color rgb 0 100 0 3.十六進製制 開頭,六位,0 f例 color 00880a font weight文字粗細 font we...