Reputation: 49
I require some help. My friend sent me an HTML document and he asked me to change the background. Now I'm new to HTML and all this but changing the background should be easy but I can't find it anywhere in the HTML doc or the CSS. Any help?
Upvotes: 1
Views: 107
Reputation: 11
Add a style for header
in your CSS file :
.header {
background: "#000000"
}
Upvotes: 1
Reputation: 4937
The HTML file contains 2 main sections - <head>, <body>
.
Head specifies attributes like page title, language, links to stylesheets (css / designs).
'Background' can be applied to any part within the <body>
section of the HTML file (including body).
Background can be applied in 2 ways -
style="background-color: color-code;"
style="background-image: url('img_girl.jpg')"
Here is an example of background being applied:
Approach 1: Background colour:
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
</head>
<body style="background-color: #e6f2ff;">
<div class="my-page">
<h1>-- Heading here --</h2>
<p>-- Description here -- </p>
</div>
</body>
</html>
Approach 2: Background image:
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
</head>
<body style="background-image: url("/paper.gif");">
<div class="my-page">
<h1>-- Heading here --</h2>
<p>-- Description here -- </p>
</div>
</body>
</html>
Note:
The background color / image can be applied to any element inside body, I.E., to div / h1 / p ...
More information:
https://www.w3schools.com/cssref/pr_background-image.asp
https://www.w3schools.com/html/html_images_background.asp
Upvotes: 1
Reputation: 198
You can change the background by using background-color or background-image as follows:
<div style="background-color: red" >
This div has a background-color of red
</div>
Upvotes: 1
Reputation: 40
The background image can be inserted in the page using the below within body tag or by using CSS: < div style="background-image:url('[image url]');>
Also, this website contain good information to go through : https://www.wikihow.com/Set-a-Background-Image-in-HTML
Upvotes: 0
Reputation: 631
div{
background-image: url("https://homepages.cae.wisc.edu/~ece533/images/tulips.png");
height:100px;
}
<div></div>
Upvotes: 1
Reputation: 87
Just create a new css for example for body like this if you want it to be black:
body {
background: #000000;
}
That should work.
Upvotes: 1