if i write for ex h1 tag before p tag in html .should i write in css code the same order:h1 selector before p selector??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

if i write for ex h1 tag before p tag in html .should i write in css code the same order:h1 selector before p selector???

https://code.sololearn.com/WRPr1ADainR5/?ref=app

12th Sep 2020, 6:09 PM
Aya Khalid
Aya Khalid - avatar
17 Answers
+ 2
It's not important... We can do any elements first unorderd ones i made h1{color:blue;} p{color:red;} body{background-color:aqua;} but it worked
12th Sep 2020, 6:12 PM
🍎Mi_ra_go
🍎Mi_ra_go - avatar
+ 2
Sonic Abrar Nithin Prabhu but in my code when i put h4 selector in the last ,the style doesn't apply to it.
14th Sep 2020, 12:48 AM
Aya Khalid
Aya Khalid - avatar
+ 1
That's not necessary
13th Sep 2020, 9:48 PM
Sonic
Sonic - avatar
0
in my code it doesn't work when i change the order.
12th Sep 2020, 6:15 PM
Aya Khalid
Aya Khalid - avatar
0
Ok please insert your code let me see
12th Sep 2020, 6:17 PM
🍎Mi_ra_go
🍎Mi_ra_go - avatar
0
h4 element doesn't have its style which i insert
12th Sep 2020, 6:57 PM
Aya Khalid
Aya Khalid - avatar
0
Save your code to playground and make it public and share it instead of sharing it in fragments.
13th Sep 2020, 1:25 AM
Divya Mohan
Divya Mohan - avatar
0
Aya Khalid I had made a h4 element and cut paste your CSS code for h4 And suprisingly it was working well. Post you code in playground to make analysis better
13th Sep 2020, 1:33 AM
Divya Mohan
Divya Mohan - avatar
0
Divya Mohan i have saved my code to playground and insert it in the post. but the style for h4 element doesn't work when i write it in this order of my css code.
13th Sep 2020, 2:21 AM
Aya Khalid
Aya Khalid - avatar
0
Close the body and HTML tag altast in HTML </body> </html>
13th Sep 2020, 2:33 AM
Divya Mohan
Divya Mohan - avatar
0
Don't try to style irrelevant things you don't have in pages. use properly empty and closed tags of html https://code.sololearn.com/WILLj8iY55L6/?ref=app
13th Sep 2020, 2:43 AM
Divya Mohan
Divya Mohan - avatar
0
Divya Mohan i think the problem(but i don't know what is this) is in the part you make it a comment as these things which you think are irrelevant i already use it but i insert only small part of my html code as it's very long.
13th Sep 2020, 2:53 AM
Aya Khalid
Aya Khalid - avatar
0
Post whatever you actually have 😀😀 Don't post it in fragments bro. It's make things complicated.
13th Sep 2020, 2:58 AM
Divya Mohan
Divya Mohan - avatar
0
The best way to access specific html element is using its id instead of class or name . With this "h1:p" you refer to all p elements inside the h1 tag and if you use only "p" it refers to all paragraph element in your html page
14th Sep 2020, 7:05 AM
Salaruddin Jalal
Salaruddin Jalal - avatar
0
Salaruddin Jalal but what's the problem if i use the class attribute to apply the style?
14th Sep 2020, 5:46 PM
Aya Khalid
Aya Khalid - avatar
- 1
No
14th Sep 2020, 12:26 PM
Abrar
Abrar - avatar
- 1
No that is not necessary
14th Sep 2020, 4:17 PM
Nithin Prabhu
Nithin Prabhu - avatar