Sat, July 24, 2021
 
https://devcodepro.comdevcodepro
X
Home · Latest · Trends
1

Responsive CSS background images

.myelement {
    background: rgb(68, 68, 68) url("images/myimage.jpg") no-repeat scroll center center / cover;
    width: 100%;
    display: block;
}

@media (min-width: 576px) {
  .myelement {
   height: 240px;
  }
}

@media (min-width: 768px) {
  .myelement {
   height: 380px;
  }
}

@media (min-width: 992px) {
   .myelement {
   height: 480px;
  }
}

@media (min-width: 1200px) {
 .myelement {
   height: 540px;
  }
}
rated 1 times (1) (0)
comments: 0 / hits: 141  / 7 months ago, sun, jan 3, 21, 03:39:57
More From » CSS
 

Comments

There are no comments for this Snippet yet
Only authorized users can post. Please sign in first, or register a free account
 
Share
Posted
pport
Member since Dec 11, 2019
Total Code Snippets: 7
Total Comments: 0
Location: Hartford, Connecticut
pport snippets
9 months ago, tue, nov 24, 20, 8:31:52
comments: 0 / hits: 186
2 years ago, wed, dec 11, 19, 10:46:24
comments: 0 / hits: 2871
PHP
2 years ago, thu, dec 26, 19, 1:40:52
comments: 0 / hits: 1507
1 year ago, wed, feb 12, 20, 2:14:06
comments: 0 / hits: 2246
9 months ago, tue, nov 24, 20, 8:40:57
comments: 0 / hits: 293
CSS
7 months ago, mon, jan 4, 21, 11:38:12
comments: 0 / hits: 130