Mon Sep 05 2022
Background-Image property
CSS3472 views
File Name: background-image-property.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Background Image Property</title>
<style>
* {
margin: 0;
padding: 0;
}
body {
background-color: #292929;
}
section {
text-align: center;
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
div.bgImg {
width: 300px;
height: 280px;
background-color: #fff;
background-image: url('https://cdn.pixabay.com/photo/2017/11/19/07/30/girl-2961959_960_720.jpg');
background-size: cover; /* container; 100px; 100%; auto; */
background-repeat: repeat /* no-repeat; repeat-x; repeat-y; repeat no-repeat; */;
background-position: left top /* right bottom; center center; */;
}
</style>
</head>
<body>
<section>
<div class="bgImg">
<h1>Welcome</h1>
</div>
</section>
</body>
</html>
Result Screenshot(s)
Author:Geekboots