B
B
Bearax2016-11-12 20:38:43
css
Bearax, 2016-11-12 20:38:43

How to use pseudo-elements correctly?

Hello, friends. I just can't figure out how to use these pseudo-elements. The fact is that I installed Font Awesome on the site in order to add icons in front of the menu areas, but I don’t know how to do it(

Answer the question

In order to leave comments, you need to log in

4 answer(s)
Y
Yaroslav Ivanov, 2016-11-12
@Bearax

You take a class or id and write in css class-name:before or after depending on where you want to put it before or after the element. Inside the block itself, you write the content attribute. Enter the value you want in parentheses.
For example \f130 is such an icon in Font Awesome
bb57d0c487c648a2b595060309da0a86.png

.class-name:before {
    content: "\f130";
}

Or just add the class name to the class="" attribute.
For example
<div class="fa-microphone"/>

N
Nick Krogan, 2016-11-12
@nollac

.class::after {
content: "";
display: block;
width: XXpx;
height:YYpx;
background-image: url(адрес изображения);
}

if you need to put "before" - then before. or make another block with the required dimensions and add the FA icon class to it if they are connected to the page

U
Uwe_Boll, 2016-11-12
@Uwe_Boll

Everything is very simple

<i class="fa fa-window-close" aria-hidden="true"></i>
<button type="button" fa fa-ban" aria-hidden="true">нажми</button>

and if you are not good with English, read

A
Artem Vedishchev, 2017-05-29
@Artem-V

I would do this:
https://jsfiddle.net/jjq4f9jj/1/
Instructions for connecting and configuring here:
https://html5book.ru/shrift-awesome/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question