+ 3
different between class p.italic and a normal .italic
Hello, I can´t see the different between the a normal class .italic { font-style: italic; } and the used one p.italic { font-style: italic; } When should I use which one of them? Best regards
3 Antworten
+ 5
If your website has only paragraphs with italic class, yes there is no difference. But if you have links with italic class too .italic will select everything with "italic" class name but p.italic will only select paragraphs, not links. For example
<a class="italic" href="page.html"> Link </a>
<p class="italic">This is an italic pragraph</p>
<p>This is another pragraph</p>
If you want to change color of italic paragraph, you should use p.italic { color: red; }.
If you use .italic { color: red; }, it will change color of link too.
+ 3
Perfect, thank you Bekir. That really makes sense :)
+ 1
thanks