+ 1

How to change background color in html

Please help

8th May 2020, 5:52 AM
Chandranshu Sharma
Chandranshu Sharma - avatar
3 Antworten
+ 3
CSS code : background : red; You can change the color name to any :)) https://code.sololearn.com/W2rHalNmDfVL/?ref=app Check this code. You'll see two box having background red and blue!
8th May 2020, 5:55 AM
Arb Rahim Badsa
Arb Rahim Badsa - avatar
+ 2
<body style="background-color: red;"> Unfortunately, in HTML it doesn't have a tag that changes background color in web page. it can only be done using css and in-line css(which is the very first line of this post)
8th May 2020, 8:06 AM
Rellot's screwdriver
Rellot's screwdriver - avatar
+ 1
You can do that in three ways First:internal css <!DOCTYPE html> <html> <head> <style> body { background-color: linen; } </style> </head> <body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> </html> Second: inline css <!DOCTYPE html> <html> <body> <h1 style="color:blue;text-align:center;">This is a heading</h1> <p style="color:red;">This is a paragraph.</p> </body> </html> Third : External css <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head> <body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> </html>. Mystayle.css body { background-color: lightblue; } h1 { color: navy; margin-left: 20px; }
8th May 2020, 6:35 AM
Ishan Shah
Ishan Shah - avatar