Answers for "div background image style"

2

div background image

#avatar {
    /* This image is 687 wide by 1024 tall, similar to your aspect ratio */
    background-image: url('http://i.stack.imgur.com/Dj7eP.jpg');
    
    /* make a square container */
    width: 150px;
    height: 150px;

    /* fill the container, preserving aspect ratio, and cropping to fit */
    background-size: cover;

    /* center the image vertically and horizontally */
    background-position: top center;

    /* round the edges to a circle with border radius 1/2 container size */
    border-radius: 50%;
}
Posted by: Guest on February-17-2021
13

how to set div background image

body {
 background-image: url("paper.gif");
 background-color: #cccccc;
}
Posted by: Guest on November-07-2019
17

background image css

.selector {
  background-image: url(image.png);
}
Posted by: Guest on May-25-2020
3

adding background image

body{background-image: url("paper.gif");}
Posted by: Guest on June-28-2020

Browse Popular Code Answers by Language