CSS : CSS MEDIA QUERY
Css Media Query คือคุณสมบัติที่มีอยู่ในภาษา CSS3 ( Cascading Style Sheets ) เป็นคำสั่งไว้สำหรับกำหนดการแสดงผลโดยอ้างถึงความกว้างของขนาดอุปกรณ์ ที่เปิดในขณะนั้น
เช่นเปิดในมือถือ ก็ให้ใช้เงื่อนไขที่ตรงกับขนาดของมือถือ เปิดในพีซีก็ให้ใช้เงื่อนไขที่ตรงกับขนาดของพีซี เป็นต้น
โดยด้านล่างนี้เป็นขนาดที่นิยมในปัจจุบันนะครับ (พศ 2562) ในอนาคตอาจมีมากกว่านี้ก็ได้ครับ
/*
##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
}
อ้างอิง https://gist.github.com/gokulkrishh/242e68d1ee94ad05f488
มาเป็นเพื่อนกันครับ บนช่องทาง Social ด้านล่างนี้ครับ
--------------------------► LINE@ : @siamfocus.com
► Facebook : fanpage.siamfocus
► Twitter (X) : siamfocus
► Linkedin : taam-siamfocus
► Instagram : iamtaam
► Youtube : SiAMFOCUS
► Tiktok : @taamsiamfocus
--------------------------