How does jQuery change the css pseudo element style and jquerycss pseudo style?

Source: Internet
Author: User
Tags html style tag

How does jQuery change the css pseudo element style and jquerycss pseudo style?

First, let's take a look at what the pseudo elements of css are:

CSS pseudo elements are used to set special effects for certain selectors.

What are pseudo elements:

: First-line: the pseudo element "first-line" is used to set a special style for the first line of the text.

: First-letter: the pseudo element "first-letter" is used to set a special style for the first letter of the text.

: Before pseudo element: ": before" the pseudo element can insert new content before the element content.

: After pseudo element: ": after" the pseudo element can insert new content after the element content.

Pseudo element example:

. Flow_ball1: after {content: ""; position: absolute; top: 50%; margin-top:-1px; left: 100%; margin-left: 0.133333rem; width: 1.786667rem; height: 2px; background-color: # ff6600; border-radius: 0.053333rem ;}
Add an orange horizontal line (similar to a flowchart) to the class label named flow_ball1)

So the question is, how can I use jquery to change the style of pseudo elements?

 

The answer is:

 $('.flow_ball1').append("<style>#fafang::after{display:none}</style>");

It was also hard to find it for a long time, because the pseudo element does not have an id, and it cannot add id to it, so it's confusing to see this method on the Internet. It's really amazing, as long as you add an html style tag to the front of the element, there is really a feeling of excitement!

 

Related Article

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.