how to make background image responsive code example

Example 1: css background image full screen responsive

html { 
  background: url(images/bg.jpg) no-repeat center center fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

Example 2: make a background image responsive css

html {
   min-height: 100%;
   background-image: url(image.jpg);
   background-size: cover;
   background-repeat: no-repeat;
   background-position: center center;
}

Example 3: Scaling Images and Videos css

.container {
  width: 50%;
  height: 200px;
  overflow: hidden;
}

.container img {
  max-width: 100%;
  height: auto;
  display: block;
}

Example 4: background shrinks when responsive

html,
body {
	width: 100%;
	height: 100%;
	margin: 0px;
	padding: 0px;
	overflow-x: hidden;
}

Example 5: how to set background image in css responsive

body{
  background:url("images/xyz.jpg") no-repeat center;

Tags:

Misc Example