Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

What is CLASS selector?

user-image
Question ajoutée par Zaid Rabab'a , Software Development Team Leader , Al-Safa Co. Ltd.
Date de publication: 2013/07/14
Roshan Thapa
par Roshan Thapa , Database and Communication Manager , Finaccess Private Limited

Class is a name given to CSS definition that applies to all the HTML elements that use the specified class for rendering.
A class selector is named by having a DOT (.) at the beginning such as .ClassName and the CSS defined is applied to all the HTML elements that use this class.
For example, you can have a CSS class as follows: .myClass { background-color:blue; } and if you specify an HTML element with the above specified class such as , then, all the elements within this DIV will have a blue background.
While using a class definition in HTML, you MUST omit the dot(.) i.e.
you need to specify class name in HTML element as "myClass" not ".myClass"

Osama Abu Rayyan
par Osama Abu Rayyan , Web Developer / Front-End Web Developer , BloomThemez

The class selector uses the HTML class attribute to set a particular style for many HTML elements with the same class.

Utilisateur supprimé
par Utilisateur supprimé

very simple select any element of html and assign to it my defined class name in css definde in css : .myparageraph { font-family: verdana; } and using it in html element

Kaombwe Simkoko
par Kaombwe Simkoko , Computer Technician , President's Office Planning Commission

The .class selector styles all elements with the specified class for example Style all elements with class="home": p.home { background:blue; } My name is Kaombwe.
I live in Tanzania.
My name is Kaombwe.
I also live in Tanzania.

adil khan
par adil khan , In Top 5 Employees , Harbin Institute of Technology, Harbin, China

The .class selector styles all elements with the specified class for example Style all elements with class="hometown": p.hometown { background:yellow; } My name is Donald.
I live in Ducksburg.
My name is Dolly.
I also live in Ducksburg.

More Questions Like This