I have a question on using the class tag on paragraph tags. I want the external Css file to style a paragraph a certain way while leaving all the other paragraphs to the default style.I did some googling and reading and found if i add <p class="somename" >
then in the css file i can change that paragraph using p.somename{ color: blue;}
But what i found is p{color: red;}
seems to be affecting them all.
This was just a example problem. The main problem im facing is that i dont want p.somename to have a background border.And the default <p>
has borders.
Put
p.somename{ color: blue }
to the bottom comparing top{ color: red}
or you can use!important
to foce your style to overwrite. for example,/* In HTML,
In CSS,
This works. You do not need to explain that is a paragraph in CSS. Only write the ID of the paragraph in CSS.*/
Only use that id on the paragraph that you want to change, while keeping others at default
In HTML,
In CSS,
Or tepkenvannkorn's answer will work.