+ 2

is it mandatory to use p.classname instead of . classname ? what is the difference

9th Jul 2016, 7:21 AM
Subhankar Debnath
Subhankar Debnath - avatar
5 Respuestas
+ 1
But when u write .classname(same paragraph element)..no change wil be observer
9th Jul 2016, 7:48 AM
princemutungi
princemutungi - avatar
+ 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..
9th Jul 2016, 9:03 AM
Sachin Shukla
Sachin Shukla - avatar
- 1
if u use p.class .-it specifies wat element you are dealing with...and that that class is assigned to the specific element
9th Jul 2016, 7:44 AM
princemutungi
princemutungi - avatar
- 1
if it was a parent element it could work
9th Jul 2016, 7:50 AM
princemutungi
princemutungi - avatar
- 2
as in that p.classname will deal with that paragraph element assigned to tht name
9th Jul 2016, 7:48 AM
princemutungi
princemutungi - avatar