Arrow

CSS Background Image

AuthorHariom Prajapati

Pubish Date23 Jul 2022

categoryCSS

  • It is use to add image in back ground.
  • In this if we use any images then it repeat vertically and horizontally until full screen is covered, so there are some tag, which fix this problem.

 

Syntax -

background-image:url('image file path');

 

For example -

<!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>Teknowize</title>

  <style>
    .BgImageCls{
     width: 100%;
     height: 100vh;
      background-image: url('teknowize.png');
    }
  </style>

</head>

<body>

  <div class="BgImageCls">
    <h1>CSS Background Image</h1>
    <p>Welcome to Teknowize</p>
  </div>

</body> 

</html> 

  

 

Output

CSS