css tag and id code example
Example 1: css class
.myclass {
border:1px solid black;
background-color: #d2d2d2;
height:20px;
width:60px;
}
Example 2: how to call an id in css
<style>
#selector {
color: red;
}
</style>
<div id="selector">
<p>This is an id</p>
</div>
Example 3: css how to style id
#example{
margin: auto;
}
Example 4: . and # in css
<!DOCTYPE html>
<html>
<head>
<style>
.classname {
background-color: green;
color: white;
}
#idname {
background-color: pink;
color: white;
}
</style>
</head>
<body>
<div class="classname">I am green colour<div>
<div id="idname">I am pink colour</div>
</body>
</html>