To make background image scale on mobile, add this to your media query:

background: url('http://something.png') no-repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;

Using min-width

// Small devices (landscape phones, 576px and up)
@media (min-width: 576px) { … }

// Medium devices (tablets, 768px and up)
@media (min-width: 768px) { … }

// Large devices (desktops, 992px and up)
@media (min-width: 992px) { … }

// Extra large devices (large desktops, 1200px and up)
@media (min-width: 1200px) { … }

Devices

Mostly looked at Apple devices. While Android-based devices are important too, they have a lot of variances in most phones. I hope it’s not a big deal for you.

Device CategoryBreakpoint WidthDevice Name
Mobile, portrait320pxiPhone SE
375pxiPhone 6 to X
414pxiPhone 8 Plus
Mobile, landscape568pxiPhone SE
667pxiPhone 6 to 8
736pxiPhone 8 Plus
812pxiPhone X
Tablet, portrait768pxiPad Air, iPad Mini, iPad Pro 9″
834pxiPad Pro 10″
Tablet, landscape1024pxiPad Air, iPad Mini, iPad Pro 9″
1024pxiPad Pro 12″ (portrait)
1112pxiPad Pro 10″
Laptop displays1366pxHD laptops (768p)
1366pxiPad Pro 12″ (landscape)
1440px13″ MacBook Pro (2x scaling)
Desktop displays1680px13″ MacBook Pro (1.5x scaling)
1920px1080p displays

Background CSS Values:

 

 

autoDefault value. The background image is displayed in its original size
lengthSets the width and height of the background image. The first value sets the width, the second value sets the height. If only one value is given, the second is set to “auto”. Read about length units
percentageSets the width and height of the background image in percent of the parent element. The first value sets the width, the second value sets the height. If only one value is given, the second is set to “auto”
coverResize the background image to cover the entire container, even if it has to stretch the image or cut a little bit off one of the edges
containResize the background image to make sure the image is fully visible
initialSets this property to its default value. Read about initial
inheritInherits this property from its parent element. Read about inherit

more similar articles