Answer the question
In order to leave comments, you need to log in
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
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
.class-name:before {
content: "\f130";
}
<div class="fa-microphone"/>
.class::after {
content: "";
display: block;
width: XXpx;
height:YYpx;
background-image: url(адрес изображения);
}
Everything is very simple
<i class="fa fa-window-close" aria-hidden="true"></i>
<button type="button" fa fa-ban" aria-hidden="true">нажми</button>
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 questionAsk a Question
731 491 924 answers to any question