0
How to add background image in html
4 ответов
+ 2
<!DOCTYPE html>
<html>
<body>
<h2>Background Image</h2>
<div style="background-image: url('img_girl.jpg');">
You can specify background images<br>
for any visible HTML element.<br>
In this example, the background image<br>
is specified for a div element.<br>
By default, the background-image<br>
will repeat itself in the direction(s)<br>
where it is smaller than the element<br>
where it is specified. (Try resizing the<br>
browser window to see how the<br>
background image behaves.
</div>
</body>
</html>
+ 1
To add background image to the body
<body style="background-image:url("the picture name and directory goes here")></body>
To add to html elements like p, div, etc.
<p style="background-image:url("IMG/tree.jpg")></p>
0
Images
https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Images_in_HTML
audio:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio
video:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video
How To Upload your phone images on SoloLearn using phone
https://code.sololearn.com/WT3661NHpV3B/?ref=app
Upload content with Dropbox [Tutorial]
https://code.sololearn.com/WW6t4B73kJVz/?ref=app
How to host/upload an image (IMGBB way)
/by Farhanaz/
https://code.sololearn.com/Wy3lrXNwGsgJ/?ref=app
Upload content with Google drive
https://code.sololearn.com/Wa25A17a19a1/?ref=app
- 1
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body, html {
height: 100%;
margin: 0;
}
.bg {
background-image: url("image.jpg");
height: 100%;
background-color: #cccccc;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
</style>
</head>
<body>
<div class="bg"></div>
</body>
</html>