0
The "class" in html and css
So in The HTML: <h1>.......</h1> <p class="example">......</p>. The CSS: h1 {.........} p.example{....} so why h1 has no "class" and p has "class"? i don't know where i missed that, please help, Thanks!
5 Respostas
+ 1
Classes are a way to categorize html elements. You can then apply a style to all the elements sharing the same class at once for example.
+ 1
<style> is for when you want to insert css in an html document. Prefer using a separate css file if possible.
0
h1 can also have class attribute
<style>
.d{color:blue;}
</style><h1 class=d>This is a Blue Heading</h1>
0
thanks for the answer. btw ManojKumar, for that code is the style tag necessary or can do without it just : .d{color:blue;} ?
0
aha thanks i get it now!:)