+ 1

Head tag and body bgcolor differnce

What is difference in page colour tag in <head> tag and <body bgcolor> in <body >tag As both have same output and also what will be output if we use both of them at same time

24th Apr 2017, 5:05 PM
rolls royce
rolls royce - avatar
1 Antwort
+ 5
There is no 'page colour tag in <head> tag' ^^ In the <head>, you can define ( or link ) some styles ( css ), and set some background color to the page by targeting the <body> tag: <!doctype html> <html> <head> <title>my page title</title> <style> body { background-color:#FF0000; /* could be 'red', or 'rgb(255,0,0)', and so on */ } </style> </head> <body> <h1>My Page Title</h1> </body> </html> ... and the 'bgcolor' attribute of the <body> tag do the same, but it's deprecated with Html5, meaning that you cannot be sure that future browsers versions will support it, even if actually they almost do: with Html5 ( <!doctype html> ), it's no more long valid, and you should avoid it :P
24th Apr 2017, 6:10 PM
visph
visph - avatar