廢話不多說,直接上代碼!!!
/*設置第一個首字母的樣式*/ p:first-letter{ color: red; font-size: 30px; } /* 在....之前 添加內容 這個屬性使用不是很頻繁 了解 使用此偽元素選擇器一定要結合content屬性*/ p:before{ content:'alex'; } /*在....之后 添加內容,使用非常頻繁 通常與咱們后面要講到布局 有很大的關聯(清除浮動)*/ p:after{ content:'&'; color: red; font-size: 40px; }