CSS: After and: What is the role of before

Source: Internet
Author: User

CSS: After and: What is the role of before:
In the current page layout: The After and: Before pseudo-object selectors don't seem to be used very often, as the low version of IE does not support it, but it also clears the floats or all other related layouts that have their application. However, as the low-version browser usage decreases, the frequency of their occurrence should increase correspondingly. Here is a brief introduction to the use of these two pseudo-object selectors, first look at a code example:

<!DOCTYPE HTML> <HTML> <Head> <MetaCharSet= "Utf-8"> <Metaname= "Author"content= "http://www.51texiao.cn/" /> <title>Ant Tribe</title> <styletype= "Text/css">Div:before{content:"added content"; } </style> </Head> <Body> <Div>|div the original content</Div> </Body> </HTML>

The above code can add the specified content to the inner front of the div element. Of course: The Before pseudo-object selector is implemented in conjunction with the content property.
Syntax structure:

E:before {}e::before{}

E represents elements that are matched with selectors, for example:

Div:before.first:before#mytest:before

In the syntax can be seen there are two grammatical forms, one is before in front of a ":", one is before front there are two ":", the first is the CSS2, the second is the writing of CSS3. IE7 and IE7 below do not support CSS2 notation, IE8 and IE8 the following browsers do not support the wording of CSS3. : Before pseudo-object selectors general and content properties are used in conjunction with adding the specified content to the front end of the specified matching element. : After pseudo-object selectors are used in the same way as: Before is the same, not introduced.

The original address is: http://www.51texiao.cn/div_cssjiaocheng/2015/0501/507.html

CSS: After and: What is the role of before

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.