ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

Explain what a class selector is and how it’s used?

user-image
تم إضافة السؤال من قبل Anirban Chakraborty , Network Administrator , Wipro Limited
تاريخ النشر: 2016/12/02
Anees Ijaz
من قبل Anees Ijaz

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.

alaa liswe
من قبل alaa liswe , ِAdministrative Assistant , Arab Open University

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:

Rohit Kumar
من قبل Rohit Kumar , web Develoer , zombiesoftwares

class selector also use for group selection.It use to select a particular tag and apply css or java script. 

Jonathan de Flaugergues
من قبل Jonathan de Flaugergues , software engineer , Abbeal

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.

 

 

 

 

 

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟