Skip to content

Instantly share code, notes, and snippets.

@gokulkrishh
Last active April 24, 2024 17:27
Show Gist options
  • Save gokulkrishh/242e68d1ee94ad05f488 to your computer and use it in GitHub Desktop.
Save gokulkrishh/242e68d1ee94ad05f488 to your computer and use it in GitHub Desktop.
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
}
/*
##Device = Laptops, Desktops
##Screen = B/w 1025px to 1280px
*/
@media (min-width: 1025px) and (max-width: 1280px) {
/* CSS */
}
/*
##Device = Tablets, Ipads (portrait)
##Screen = B/w 768px to 1024px
*/
@media (min-width: 768px) and (max-width: 1024px) {
/* CSS */
}
/*
##Device = Tablets, Ipads (landscape)
##Screen = B/w 768px to 1024px
*/
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
/* CSS */
}
/*
##Device = Low Resolution Tablets, Mobiles (Landscape)
##Screen = B/w 481px to 767px
*/
@media (min-width: 481px) and (max-width: 767px) {
/* CSS */
}
/*
##Device = Most of the Smartphones Mobiles (Portrait)
##Screen = B/w 320px to 479px
*/
@media (min-width: 320px) and (max-width: 480px) {
/* CSS */
}
@rumanmushtaq
Copy link

do i still need to write it if I'm using bootstrap?

no bootstrap is already responsive

@AlexRousseau92
Copy link

Thank you :)

@mukul5884
Copy link

Thank. helpful content

@Joshua-Nweze
Copy link

You're a life saver

@leox23
Copy link

leox23 commented Sep 28, 2022

Thanks men!

@patobottos
Copy link

Thank you Gokulakrishnan! It helped me a lot!

@pwdbymoral
Copy link

Sensacional! :)

@roustomit
Copy link

Thanks

@tikiyiki
Copy link

Thank you so much !

Copy link

ghost commented Jan 19, 2023

thank you so much!

@ifdotcom
Copy link

@DevKaliper
Copy link

Thanks bro

@pestevao
Copy link

pestevao commented Apr 4, 2023

Excellent!

@fancybrackets
Copy link

Thank you so much

@moniglz
Copy link

moniglz commented Apr 12, 2023

@alfanoor
Copy link

alfanoor commented May 5, 2023

thank you

@Augustine97
Copy link

Augustine97 commented May 20, 2023

Thanks for these useful content @gokulkrishh

there are mobile devices which has width less than 320px, like the Samsung galaxy fold
For the same we can use the below media query

@media (max-width: 319px) {
   /*CSS*/
}

@Flip1956
Copy link

How do i put this in website

@StellarStoic
Copy link

How do i put this in website

Learn about CSS and media queries. YouTube is full of tutorials. There's many way to add this into your website and without knowing what you have we can't tell you to do it this or that way.

@devDoubleH
Copy link

Thanks bro

@Os-humble-man
Copy link

Thank you

@dkraj235
Copy link

Thank You

@roustomit
Copy link

Thanks All

@vstruk01
Copy link

Thanks a lot

@niki4etoo
Copy link

Nice and Descriptive! Thanks a lot!

@romanmesh
Copy link

Thank you! But what about the iPhone 15 Pro Max? It has a 1290px width, doesn't it?

@tvd487
Copy link

tvd487 commented Nov 29, 2023

really helpful

@danielfnz
Copy link

Thank you!

@mininxd
Copy link

mininxd commented Jan 26, 2024

hohoho there you are

@AbduraufAslanov
Copy link

Thank you 👍 )👍🙌(●'◡'●)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment