0

How can i use class for font family and font size in a paragraph in HTML and reference them in CSS for styling?

28th Apr 2016, 11:16 PM
Uk-De Don
Uk-De Don - avatar
2 Réponses
+ 1
If what you are asking is how to assign a class to an element, and then reference that element in CSS: Insert an ID inside the opening tag of an element, then reference that in CSS, like so: HTML <p id="turtle">This element now has an id of turtle.</p> CSS #turtle { font-size: small }
13th May 2016, 2:18 AM
Sean Medlin
Sean Medlin - avatar
+ 1
If you want to create a reusable item in the css, use a class. Ids should be unique. HTML <p class="sampleFont">This paragraph will have the class sampleFont applied.</p> CSS .sampleFont { font-family: Arial; font-size: 25px; }
25th Jun 2016, 6:06 PM
Alissa Ackerson Herbert
Alissa Ackerson Herbert - avatar