0% found this document useful (0 votes)
44 views39 pages

Selector:: For All Href Attributes of Anchor Tag This Style Is Applicable

The document describes four types of CSS selectors: 1. Universal selector (*) applies styles to all elements on a page. 2. Descendant selector (li a) applies styles to anchor tags nested within li tags. 3. Adjacent sibling selector (a+ul) applies styles to ul tags immediately following a tags. 4. Attribute selector (a[href]) applies styles based on element attributes like href.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views39 pages

Selector:: For All Href Attributes of Anchor Tag This Style Is Applicable

The document describes four types of CSS selectors: 1. Universal selector (*) applies styles to all elements on a page. 2. Descendant selector (li a) applies styles to anchor tags nested within li tags. 3. Adjacent sibling selector (a+ul) applies styles to ul tags immediately following a tags. 4. Attribute selector (a[href]) applies styles based on element attributes like href.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 39

27) </ul>

28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }
2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }
For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }
For all href attributes of anchor tag this style is applicable.
27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }
li is considered as parent tag and a is considered as child tag.
For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }
For every ul tag which is adjacent to a tag,this style is applicable.
1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }
For every ul tag which is adjacent to a tag,this style is applicable.
1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable. 27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }

For all href attributes of anchor tag this style is applicable.


27) </ul>
28) </body>
29) </html>
1. * selector:
* means everything. This style is applicable for every thing in the web page.
1) *{
2) color:blue;
3) }

2. Descendant Selector:
1) li a{
2) color:white;
3) background: blue;
4) }

li is considered as parent tag and a is considered as child tag.


For every anchor tag present in li tag this style is applicable
3. Adjacent Selector:
1) a+ul{
2) color: red;
3) }

For every ul tag which is adjacent to a tag,this style is applicable.


1) div+p{
2) color:blue;
3) }

For every paragraph tag, which is adjacent to div tag this style is applicable.
4. Attribute Selector:
We can define style based on attributes.
Eg 1:
1) a[href]{
2) color:red;
3) background: yellow;
4) }
For all href attributes of anchor tag this style is applicable. yle Sheets)
 CSS stands for Cascading Style Sheets
 CSS is used to control the style of a web document in a simple and easy way.
 CSS saves a lot of work. It can control the layout of multiple web pages all at
once
 Styling includes colors,fonts,size,borders etc

Note: We can define CSS styling inside HTML. But it is highly recommended to define styling inside a
seperate CSS file(.css extension) and link that file to HTML.

 CSS Style Rule Syntax as follows

selector { property: value }

Various ways to define Style for HTML Elements:


We can define style in 3 ways
1. In Line
2. By using style tag
3. By using css file

1. In Line:
<h1 style="color:red">This is My First Part of Data</h1>

define style at tag level is not recommended b'z it increases complexity as every html page contains
1000s of tags
2. By using style tag:
1) <html >
2) <head>
3) ...
4) <style type="text/css">
5) h1{
6) color:blue;
7) }
8) </style>
9) </head>
10) ...
11) </html>

This way of defining style is not recommended because it is applicable only for current page but not
for remaining pages.

3. By using css file:


style1.css
1) h1{
2) color:red;
3) }
4)
5) <head>
6) <link rel="stylesheet" href="style1.css">
7) </head>

We can reuse same css file for every html page so that we can promote code reusability. Hence this
approach is highly recommended to use.

You might also like