أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.
Class selector is used to style html element In easy way.
It s defined in style sheet file by a dot and is applied by class attribute in html tag.
Basic html only creates a mock up of the web page but that does not look beautiful or according to your needs. Cascading style sheet is used for this purpose.
So what are the xhanges can be made by using class attribute and styling sheet.
Well it depends on the html object or content you are working on but most common things are borders, text colors, background colors, width, height, margins, paddings and much more.
So if you have heard about Id selector you may think whats the difference.
Id is used to style only one type of specific element like a button or a comment or any content.
But class selector is used in styling more than one contents and objects. Like you can have a class named. fullwidth and you can assign this class to any element you want to be a element having full width.
The universal selector works like a wild card character, selecting all elements on a page. Every HTML page is built on content placed within HTML tags. Each set of tags represents an element on the page. Look at the following CSS example, which uses the universal selector:
class selector also use for group selection.It use to select a particular tag and apply css or java script.
The class selector allows to selects elements with a specific class attribute and to define a specific style to its.
We use class selector instead of id selector to define a style for more than one element.Example :.my-class { color: red;}<div class="my-class"> <div class="my-class"></div></div>
Both div will apply the red color style defined in the my-class selector.