Answers for "set background image"

CSS
125

css background image

background-image: url("image.png");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
Posted by: Guest on April-07-2020
4

make image background of div

background-image: url("photographer.jpg");
Posted by: Guest on April-03-2020
21

background image

div {
  background-color: #ffffff;
  background-image: url("img_tree.png");
  background-repeat: no-repeat;
  background-attachment: scroll|fixed|local|initial|inherit;
  background-position: right top  |  x% y%  |  xpos ypos;
  background-clip: border-box|padding-box|content-box|initial|inherit;
  background-size: auto|length|cover|contain|initial|inherit;
}
//shorthand:
div {
  background: #ffffff url("img_tree.png") no-repeat right top;
}
Posted by: Guest on September-07-2020
5

background image html

<!-- Background images are better implemented in CSS -->
<!-- but here is how you could do it in HTML in a pinch -->

<head>
  <style>
    .background {
      background-image: url(https://cleananddelicious.com/wp-content/uploads/2016/03/Avocad0-CD.jpg);
    }
  </style>
</head>

<body>
  <div class=background>
    <h1>The background of this div will be an avocado</h1>
  </div>
</body>
Posted by: Guest on February-18-2020

Browse Popular Code Answers by Language