By creating your own website and filling it with some elements of the web page, everyone will surely come up with a concept like CSS selector. Selectors can be helpful since it accurately determines all the elements of the HTML-file on the web page, their design and location.
How to create Selectors
To do this, create a CSS document that defines their rule or their other selectors and parameters for their formatting, such as: color, size, position, and more.
Every web designer should know and be able to enter the required selectors correctly. Selectors are divided into types, the main hazards which we will consider below.
Types of selectors in CSS
Depending on which HTML element the formatting is applied to, the CSS selector may refer to one of the following groups:
- Tag selector;
- Class selector;
- Attribute selector
Also called “type selector” or “by element”, it is the simplest and most common used, as it is the name of the elements of the html-file that we describe in the CSS-document.
And what if you need to set your own style for each paragraph? So, there is a class selector also known as custom style selectors. It’s name depicts the function of this kind of selector. Meaning you can assign any name to this kind of selector.
In this case in the html-document, you first enter a class attribute with the style name. Classes can be as many styles as you want to apply to the elements of a web page.
For conventional purpose, always name a style by what the style does to the web page to aid debugging and for other web developer who may contribute to your website.
For example, use btn as a name for a class selector to style the button on a website.
If you find value in this article. Please like, share and comment. Thanks