Z
Z
Zadavajka2015-10-14 13:04:27
css
Zadavajka, 2015-10-14 13:04:27

How to use before and after pseudo-elements?

I kind of know how these pseudo-elements work, but in practice I don't know how to use them, please tell me how you use :before and :after ?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
D
dm, 2015-10-14
@Zadavajka

Dividers in menu items - How to make a strip between items in a horizontal menu?
Login icon - demo.smartseven.ru/BarbershopBorodinski Squares
/crosses in the sidebar in manufacturers - demo.smartseven.ru/BarbershopBorodinski/shop.html Top
right corner on products - savenkova.esy.es/barbershop/shop.html
White diamonds under headings - savenkova.esy.es/barbershop/index.html
Etc. etc. For decorative items.

D
Dmitry Kravchenko, 2015-10-14
@mydearfriend

For the most part, for design elements, all sorts of designer Wishlist, such as beaten ribbons .
Sometimes it is possible to display some information through
content: attr(attr-name)

D
Denis Ineshin, 2015-10-14
@IonDen

Their essence is to reduce the HTML code. You can do without them altogether, for example, by making such a construction:

<div class='item'>
    <div class='before'></div>
    контент
    <div class='after'></div>
</div>

0
0leg5ergeev, 2015-10-14
@0leg5ergeev

#section-1:after {
    content: ' ';
    display: block;
    width: 100%;
    height: 5px;

S
Sergey Nekrasov, 2015-10-14
@Judixel

Mostly for decorative things on the site, I used to use them often so as not to clog the html with unnecessary tags

D
deeppines, 2015-10-14
@LucasKane

For example, for fix float

.clearfix:after {
  content: " ";
  display: table;
  clear: both;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question