CSS的偽類內容產生

來源:互聯網
上載者:User
這次給大家帶來CSS的偽類內容產生,CSS的偽類內容產生的注意事項有哪些,下面就是實戰案例,一起來看一下。

1、 通過 css 向已有的元素上增加新的文本(圖片)內容
選取器:
1、:before
向匹配元素之前增加產生的內容
定位到匹配元素開始的位置
2、:after
向匹配元素之後增加產生的內容

eg:

div:before{}
p:after{}
屬性:

1、content
作用:配合 :before , :after虛擬元素插入產生的內容div:before{
content:"產生的內容:";
}
常用取值:
字串:普通文本
url:映像
計數器;

相信看了本文案例你已經掌握了方法,更多精彩請關注php中文網其它相關文章!

相關閱讀:

瀏覽器不相容我寫的代碼怎麼辦

2018最新前端面試題十一

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.