+ 5

The <body> tag

can i apply an id or class to the <body> tag? it works but i don’t know if that’s right or not. <html> <head> </head> <body id= "container"> </body> </html>

30th Mar 2017, 4:21 PM
S_M_A
S_M_A - avatar
4 Respostas
+ 13
it's possible but like @Mario L said it makes no sense, you can just use this in css body { } or this in js document.getElementsByTatName ("body")[0]
30th Mar 2017, 5:03 PM
Kamil
Kamil - avatar
+ 7
yes u can https://code.sololearn.com/WpFEQ9We601Z/?ref=app i have added class for body to make it cool
2nd Apr 2017, 4:06 AM
Prashanth Kumar
Prashanth Kumar - avatar
+ 6
since there's only one body in an html document, it's useless to apply class or id to it.
30th Mar 2017, 5:01 PM
Mario L.
Mario L. - avatar
+ 4
ty, that's right but I need that id to use it on Javascript
30th Mar 2017, 5:05 PM
S_M_A
S_M_A - avatar