Selectors in CSS

Selectors in CSS

Selectors in CSS

The purpose of? HTML is to structure the data into different sections on the webpage. Example word document. The word document has different sections like header footer etc. Along similar lines, we have a webpage with different sections like body title, paragraph etc. We need to style the different sections on the webpage. This is done using CSS. First, we need to select the individual elements to apply some styling to them. In CSS we do this using? CSS selectors.

The different types of selectors are:

1. Simple Selectors :

a.Class selector: In this selector, we group multiple HTML elements to form a class then we apply the necessary styling to all the elements present in that particular class.

b. id selector: Same as class selectors but the only drawback is we can use only one id to select only one particular HTML element?

2. Combinator Selectors:

These are used to explain the relationship between two CSS selectors. The selection will happen based on the relationship between the selectors

3. Pseudo-Selectors:

There are two types of pseudo-selectors :

1. pseudo-class selector

2.pseudo-element selector

1:Pseudo Classes:

The word pseudo in English means: not actually but having the appearance of.

Pseudo is a keyword which is added before a selector to identify a special state or representation.

When used before a selector, the class will be styled only when that particular thing happens on the webpage. For example, a word changes its colour only when we hover the mouse over it. Till the time we do not hover over it the styling will not be applied hence they are given the name as pseudo

2. Pseudo Elements:

Pseudo Elements are called pseudo because they are virtual elements that are they are not present in the Document Object Model and rendered by the browser

iNeuron.ai

要查看或添加评论,请登录

Jeevan Henry Dsouza的更多文章

  • Mystery Behind Node js

    Mystery Behind Node js

    What is Node JS ? Computer only understands 1 & 0 or in other words Machine Code. Every programming language has its…

  • Stacking Contexts In CSS

    Stacking Contexts In CSS

    Stacking Context : It is a group of elements positioned on the Z-axis. Stacking Contexts can be nested within other…

  • Flexbox

    Flexbox

    FlexBox: as the name suggests it is a flexible box. It makes positioning much easier than normal methods.

  • Git Hub Markdown Cheat Sheet

    Git Hub Markdown Cheat Sheet

    !-- Markdown is a way to style text on the web. We control the display of the document;formatting words as bold or…

  • Positioning in CSS

    Positioning in CSS

    Positioning in CSS: (pre-requisite for this topic is the DOM) The top, right, bottom, and left properties are used to…

社区洞察

其他会员也浏览了