Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSS

How to keep same background-image ratio/size on all different screen sizes?

#background{
  background-image: url("../images/houses.png"); /* The image used */
  background-color: whitesmoke; /* Used if the image is unavailable */
  height: 500px; /* You must set a specified height */
  background-position: center; /* Center the image */
  background-repeat: no-repeat; /* Do not repeat the image */
  background-size: cover; /* Resize the background image to cover the entire container*/
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #screen
ADD COMMENT
Topic
Name
7+7 =