Sarnath India
  • Home
  • NodeJs
  • PHP
  • CSS
  • Javascript
  • Privacy Policy
  • Terms and Conditions
  • Disclaimer
  • DMCA
  • About Us

Subscribe to Updates

Get the latest creative news from FooBar about art, design and business.

What's Hot

How to Install Node.Js on Windows Machine

March 23, 2023

Image/File Upload with Progressbar Using PHP & Jquery

March 1, 2023

Display location on google map from address using javascript google map api

March 1, 2023
Facebook Twitter Instagram
Sarnath India
  • Home
  • NodeJs
  • PHP
  • CSS
  • Javascript
Sarnath India
Home»CSS»CSS Media Queries for All The Common Devices
CSS

CSS Media Queries for All The Common Devices

sarnathindiaBy sarnathindiaFebruary 28, 20233 Mins Read
Facebook Twitter Pinterest LinkedIn WhatsApp Reddit Tumblr Email
CSS Media Queries for All The Common Devices
Share
Facebook Twitter LinkedIn Pinterest Email

CSS Media Queries are a feature of Cascading Style Sheets (CSS) that allow you to apply different styles to a website or web application based on the characteristics of the device or screen that is being used to view it.

This can include the size of the screen, the orientation of the device, the resolution of the screen, and many other factors.

Using media queries, you can create different layouts and styles for different devices, such as desktop computers, laptops, tablets, and mobile phones.

This allows you to create responsive web designs that adapt to different screen sizes and provide an optimal user experience on any device.

Media queries are typically written as a block of CSS code that is enclosed in a set of curly braces and preceded by a media type and one or more media features.

For example, the following media query applies styles only to devices with a maximum screen width of 768 pixels:

CSS
@media only screen and (max-width: 768px) {
  /* Styles for devices with a maximum screen width of 768 pixels go here */
}
CSS

Media queries can be used in conjunction with other CSS features, such as responsive design frameworks, to create flexible and adaptive web designs that look great on any device.

CSS Media Queries for All The Common Devices

here’s an example of CSS media queries for common devices:

CSS
/* Extra small devices (phones, up to 576px) */
@media only screen and (max-width: 576px) {
  /* Styles for extra small devices go here */
}

/* Small devices (phones, 576px and up) */
@media only screen and (min-width: 576px) {
  /* Styles for small devices go here */
}

/* Medium devices (tablets, 768px and up) */
@media only screen and (min-width: 768px) {
  /* Styles for medium devices go here */
}

/* Large devices (desktops, 992px and up) */
@media only screen and (min-width: 992px) {
  /* Styles for large devices go here */
}

/* Extra large devices (large desktops, 1200px and up) */
@media only screen and (min-width: 1200px) {
  /* Styles for extra large devices go here */
}
CSS

These media queries target devices with different screen sizes, from extra small devices such as phones up to large desktop screens. You can adjust the specific breakpoints and styles based on your design needs.

Specific media queries for common devices

CSS
/* iPhone X */
@media only screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) {
  /* Styles for iPhone X go here */
}

/* iPad */
@media only screen and (device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 1) {
  /* Styles for iPad go here */
}

/* iPad Pro */
@media only screen and (device-width: 1024px) and (device-height: 1366px) and (-webkit-device-pixel-ratio: 1) {
  /* Styles for iPad Pro go here */
}

/* Galaxy S5 */
@media only screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 3) {
  /* Styles for Galaxy S5 go here */
}

/* Surface Duo */
@media only screen and (min-device-width: 540px) and (max-device-width: 720px) and (-webkit-device-pixel-ratio: 2) {
  /* Styles for Surface Duo go here */
}
CSS

These media queries target specific devices with different screen sizes, device pixel ratios, and aspect ratios. You can use tools such as BrowserStack or Device Mode in Chrome DevTools to test your website on different devices and adjust your media queries accordingly.

CSS
Share. Facebook Twitter Pinterest LinkedIn WhatsApp Reddit Tumblr Email
sarnathindia
  • Website

My name is Rohit Vadaviya and I am Programmer, Analyst And Blogger based in Baroda, India. I try to share some awesome scripts on my blog which I personally feel are useful for me as well as all developers, programmers and designers while working on any project.

Related Posts

CSS February 28, 2023

How to create rounded profile picture using pure CSS

CSS February 27, 2023

CSS Wave Animation Examples

CSS February 27, 2023

CSS Skeleton Loadings Example + Source Code

Leave A Reply Cancel Reply

Top Posts

How to import excel file into mysql using php

February 26, 202329 Views

How to create chat application using node.js and socket.io

February 26, 202323 Views

Read RSS feed of website (blog) using php

February 27, 202318 Views

Subscribe to Updates

Get the latest tech news from FooBar about tech, design and biz.

Most Popular

How to import excel file into mysql using php

February 26, 202329 Views

How to create chat application using node.js and socket.io

February 26, 202323 Views

Read RSS feed of website (blog) using php

February 27, 202318 Views
Our Picks

How to Install Node.Js on Windows Machine

March 23, 2023

Image/File Upload with Progressbar Using PHP & Jquery

March 1, 2023

Display location on google map from address using javascript google map api

March 1, 2023

Subscribe to Updates

Get the latest creative news from FooBar about art, design and business.

Sarnath India
  • Home
  • About Us
  • Privacy Policy
  • Terms and Conditions
  • Disclaimer
  • DMCA
© 2023 ThemeSphere. Designed by ThemeSphere.

Type above and press Enter to search. Press Esc to cancel.