0

What is id and class in html

11th Jan 2017, 4:25 AM
Apurva N. Saraogi
Apurva N. Saraogi - avatar
3 Respuestas
+ 1
ID and class are both CSS Style selectors. In your CSS, when you format a style you initialize the name of that style. To use ID, initialize your style with # before the name. To use class, initialize your style with . before the name. Use either of them in your html code by calling "id=" or "class=". The both do the same thing. It is upto you to choose what you would want to use.
11th Jan 2017, 5:20 AM
Imran Din
Imran Din - avatar
+ 1
They're also selectors for javascript
11th Jan 2017, 1:42 PM
Louis Milotte
Louis Milotte - avatar
+ 1
.class #id Don't forget they override if they're all on the same tag: the last class override the previous class id override class style override id and using !important override them all <style> body { background-color: black; font-family: Monospace; color: red; } #white-text { color: white; } .blue-text { color: blue !important; } .green-text { color: green; } </style> <h1 class="blue-text green-text" id="white-text" style="color: orange">Hi all!</h1>
8th Feb 2017, 11:37 PM
totoro
totoro - avatar