HOME
          About US
          Contact Us

CSS Text Grouping

Chapter - 24 : Grouping and Nesting (CSS Text Grouping)


These selectors are not a new element or tag, but this is the way of defining the element in smarter way.

i) Grouping Selectors: In 'Table' chapter, you might have noticed that we have defined property and value of 'table' and 'td' in one line. Similarly if property and value for various elements is same, then it can be defined together.

e.g. Let us say h1 and p elements are having same property and value style sheets there are often elements with the same style.

h1 {color:blue; font-style:arial;}
and
p {color:blue; font-style:arial;}

then the both can be defines together
h1,p {color:blue; font-style:arial;}
This is what is known as 'Grouping Selectors' in web development.

ii) Nesting Selectors: We have seen that 'class' is an element within an element. Let us say that we are having a 'class' element by the name 'new1' inside a 'p' element. Then in 'style sheet' It may be defined as

P {color:blue; font-style:arial;}
And
.new1 {background-color:yellow;}

then the both can be defines together
. new p {color:blue; font-style:arial background-color:yellow;}
This is what is known as 'Nesting Selectors' in web development

CSS Text Grouping
© funandhobby.com (CSS Text Grouping)