Computer >> คอมพิวเตอร์ >  >> การเขียนโปรแกรม >> CSS

แบบสอบถามสื่อด้วย CSS3


ข้อความค้นหาสื่อใช้สำหรับกฎรูปแบบที่แตกต่างกันสำหรับอุปกรณ์ขนาดต่างๆ เช่น โทรศัพท์มือถือ เดสก์ท็อป ฯลฯ

คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อใช้งานการสืบค้นสื่อด้วย CSS3 -

ตัวอย่าง

<html>
   <head>
      <style>
         body {
            background-color: lightpink;
         }
         @media screen and (max-width: 420px) {
            body {
               background-color: lightblue;
            }
         }
      </style>
   </head>
   
   <body>
      <p>If screen size is less than 420px, then it will show lightblue color, 
      or else it will show light pink color</p>
   </body>
</html>