+ 2
is it mandatory to use p.classname instead of . classname ? what is the difference
5 odpowiedzi
+ 1
But when u write .classname(same paragraph element)..no change wil be observer
+ 1
It is not necessary to write p.classname .. but in case when u wanted that your class css only aaplied to paragraph element.. then u use that in a scenario when that class used by other elements also.. and it is good practice to use selector with elements because it makes dom searching faster..
- 1
if u use p.class .-it specifies wat element you are dealing with...and that that class is assigned to the specific element
- 1
if it was a parent element it could work
- 2
as in that p.classname will deal with that paragraph element assigned to tht name