How does this relate,for example <div id="intro"> and <p class="first"> | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How does this relate,for example <div id="intro"> and <p class="first">

14th Dec 2016, 12:34 PM
Thembinkosi Sukazi
Thembinkosi Sukazi - avatar
2 Answers
0
If you write it as you wrote than nobody can answer you correctly. Is <p> in <div> or the opposite? Are right behind each other?
14th Dec 2016, 1:01 PM
Ondřej Doněk
Ondřej Doněk - avatar
0
Use a class when you want to consistently style multiple elements throughout the page/site. For example, the jQuery form validator plugin heavily uses classes to define the validation Use the ID when you have a single element on the page that will take the style. Example:- #header_id {font-color:#fff} .header_class {font-color:#000} (Note that CSS uses the prefix # for IDs and . for Classes.)
14th Dec 2016, 1:18 PM
The Programmer Life
The Programmer Life - avatar