1
Hello, everyone. I’m a beginner in programming and I have a question in CSS. In a code where I want all H5 who have the class . special be red, there is some difference between H5.special and . special H5? Using H5.special, I got what I wanted, but using . special H5, I did not get the same result. Why? When should I use the selector after the class and the reverse?
HTML:
<html>
<head>
<link rel="stylesheet" type ="text/css" href="style.css"/>
</head>
<body>
<h5 class="special"> Destino </h5>
<br> texto texto texto texto texto texto <br>
<br> texto texto texto texto texto texto <br>
<h5>Destino </h5>
<br> texto texto texto texto texto texto <br>
<br> texto texto texto texto texto texto <br>
<h5 class="special"> Destino</h5>
<br> texto texto texto texto texto texto <br>
<br> texto texto texto texto texto texto <br>
</body>
</html>
CSS:
h5.special {
color: red;
}
Thank you in advance.