Ticker

6/recent/ticker-posts

Header Ads Widget

Responsive Advertisement

Selectors in CSS - Source Code

 Selectors in CSS




There are three types of selectors in CSS. Element selector, id selector, class selector and group selector. 

All the source code is available


HTML code(tutorial_2.html)


<!DOCTYPE html>
<html lang="en">
<head>
    <link rel="stylesheet" href="style.css">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- Element selector -->
    <h1 class="head">This is a example of Element selector</h1>
    <!-- id selector -->
    <div id="main">THis is a example of id selector</div>
    <!-- class selector -->
    <p class="text">This is a example of class selector</p>

    <!-- group selector -->

    <p class="element">this is a example of group selector</p>
    <h1 class="header">this is also a example of group selector</h1>



</body>
</html>




SanDisk Cruzer Blade 32GB USB Flash Drive

CSS code(style.css)

/* Element selector  */
 h1{
    color: crimson;

 /* id selector  */
 #main{
    color: darkgreen;
    font-size: large;
}  

 /* class selector  */
 
.text{
    color: blue;
    background-color: gray;
}
/* group selector */

.element, .header{
    color:red ;
    background-color: rosybrown;
}


"Programming is thinking not typing" - sagnik sarkar

Post a Comment

0 Comments