Javascript Css After

| | | | | | | | | | | | | | | | | | | | | | | | | | | | |

👻 Check our latest review to choose the best laptop for Machine Learning engineers and Deep learning tasks!

The CSS:: before the content of the selection inserts before a selected element. CSS: after the content of inserts after a specified element. These selectors are commonly used to add text before or after a paragraph or link.

When designing a website, you can add content before or after content on a page. element. For example, you can add an image before each bullet in a list.

This is where:: before and after:: pseudo-CSS elements come in. These pseudo-elements allow you to insert content before or after the content of an element.

This tutorial will discuss, referring to examples, how to use the:: before and after:: pseudo-elements to decorate the content of a web page. By the time you finish reading this tutorial, you will be an expert at using:: before and after:: pseudo-elements in CSS.

CSS pseudo-elements

A pseudo-element is a special keyword that allows you to style a specific part of the elements selected by a CSS selector. In this article, we’ll call pseudo-elements as selectors because each pseudo-element is a selector

Pseudo-elements are useful when you want to style an element without adding CSS or classes ID to the element. For example, if you want to add a ">" arrow after each link on a web page, you can use a pseudo-element.

CSS offers a wide range of pseudo-elements. In particular:: first line,:: first-letter,:: before and after::. For the purposes of this tutorial, we’ll focus on the last two::::: before and after.

Pseudo-elements are typically represented using colons (::). Although CSS3 supports the use of single dot (:) syntax to declare a pseudo-element, using colon notation is best practice

This is because the notation colon is used to distinguish the pseudo-class placeholders.

CSS:: before element pseudo-element

It:: before pseudo- l "adds content that appears before an element on a web page Often this element is used to append some text before a paragraph

the syntax of:: before pseudo-element is: ..

The:: before selector is added after. the name of the element to which you want to apply the selector

Here are the main components of the front:: pseudo-element:

If you are interested in learning more about how selectors work in CSS, read our guide CSS Selectors .

Let take an example to demonstrate how the:: before the pseudo-element works.

Suppose we want to add an emoji (Ôîó) link before each link in a sample web page. We could do this using the following code:

Our code returns:

Capture d ’ screen from 2020 12 09 08 00 16

We did this by specifying a content property in our CSS file, which looks like this:

content: "Ôîó";

Our rule added an emoji link at the start of our tag that we created

the value of the attribute "content" can be:.

You cannot insert an HTML element into the content attribute.

the CSS:: after pseudo-element

the CSS:: after pseudo-element allows you to add content immediately after an element on a web page. Just like the:: before selector, after:: is often used with links or paragraphs of text.

Th The syntax of p seudo-element:: is after the following:

the:: after syntax is the same as the syntax for the:: before pseudo-element.:: accepts after the same values ​​for the "content" attribute we discussed earlier

:: after CSS Example

Suppose you are designing a link element on a site for a bakery called Hansons Bakery. This link should display the text "Go to page Home Hansons Bakery. " Our link should be surrounded by a solid black border 1 pixel wide.

After our label we want a text box to appear with the content This page our baked goods menu . (Note the white space before the word "This".) Our box should have an orange HTML background color .

We could do this using the following code:

Our code generated content similar to this:

Capture of 2020 12 09 08 00 47 1