Query Media in CSS
@media in CSS is a feature that allows us to customize CSS to fit different devices
@media in CSS is a feature that allows us to customize CSS to fit different devices like desktop, tablet, smartphone, TV device and printing device .
These media queries will look at different aspects such as the viewport's width and height, the width and height of the display device, the direction of use is horizontal or vertical along with a specific resolution to adjust for well suited.
@Media syntax
This attribute has the following syntax:
@media not|only mediatype and (media feature) {
CSS-Code;
}
Media Type
Media Feature
Some examples
1. If the browser width is less than or equal to 600px, hide the element div class example
@media screen and (max-width: 600px) {
div.example {
display: none;
}
}
Full code:
Hide the div when the screen size is smaller
TipsMake.com is a social network about science and technology, expanding content to
meeting members' needs for more technology fields such as electricity
voice, smart device, electronics, computer security .
2. If the browser width is greater than 800px, set the lavender, 400px to 999px background color to lightsalmon, less than 400px then lightblue.
body {
background-color: lightblue;
}
@media screen and (min-width: 400px) {
body {
background-color: lightgreen;
}
}
@media screen and (min-width: 800px) {
body {
background-color: lavender;
}
}
Website TipsMake.com
TipsMake.com is a social network about science and technology, expanding content to
meeting members' needs for more technology fields such as electricity
voice, smart device, electronics, computer security .
3. Create a flexible navigation menu that displays multiple interface sizes (displayed horizontally on a large screen and vertically on a small screen):
@media screen and (max-width: 600px) {
.topnav a {
float: none;
width: 100%;
}
}
Website TipsMake.com
TipsMake.com is a social network about science and technology, expanding content to
meeting members' needs for more technology fields such as electricity
voice, smart device, electronics, computer security .
Làng Công nghệ
Công nghệ
Cuộc sống
4. Create flexible display columns interface that meets a variety of interface sizes.
/* hiển thị 2 cột thay vì 4 cột mặc định khi màn hình có chiều rộng dưới 920px*/
@media screen and (max-width: 992px) {
.column {
width: 50%;
}
}
/* các cột xếp chồng lên nhau thay vì cạnh nhau khi màn hình có chiều rộng dưới 600px */
@media screen and (max-width: 600px) {
.column {
width: 100%;
}
}
You resize the browser to see the change:
Website TipsMake.com
QTM
Some text .
QTM
Some text .
QTM
Some text .
QTM
Some text .
5. Create layout website display flexibly to meet many interface sizes.
Page Title
Website TipsMake.com
Knowledge - Experience - FAQ
Using flexible layout.
Làng Công nghệ
Công nghệ
Khoa học
Cuộc sống
Introduce
TipsMake.com is a social network about science and technology.
Highlights
Follow Me
YouTube
Form - Form in CSS
Quách Tỉnh, February 14, 2019
Forms are an integral part of any kind of website.
In this article, TipsMake.com will show you how to build the section
giao diện hiển thị của một biểu mẫu cơ bản. Giao diện này có thể được làm
khá đẹp mắt với CSS
Attribute Selector in CSS
Quách Tỉnh, February 14, 2019
Attribute selector is the way to select the elements you want to type in
tài liệu HTML dựa vào thuộc tính của một hay nhiều thẻ HTML nào đó.
Attribute selector can select objects without having to
khai báo thêm các Class hoặc ID vào trong thẻ HTML và vẫn có thể hướng
được đến các thành phần đó, giúp code gọn gàng hơn và mạch lạc hơn.
License No. 362 / GP-BTTTT. Ministry of Information and Communications issued on June 30, 2016.
You should read it
- 22 shortcuts to VLC for Windows and Mac
- Advanced tricks use VLC Media Player
- Summary of shortcuts in Windows Media Player
- 5 social media trends in 2014
- How to Protect Your Kids on Social Media
- VLC Media Player 3.0.11
- How to fix 3 problems with VLC Media Player
- How to Download Windows Media Center
- How to record webcam videos on VLC Media Player
- Set up VLC Media Player as the default multimedia player on Windows 10
- How to download and install Windows Media Player 12 on Windows 10
- What is Media File Jacking?
Maybe you are interested
How to mute when taking pictures for iPhone fast, simple Instructions for using Bluetooth on devices Instructions for sending secret messages on Zalo 10 misconceptions about electronic devices that we have long believed Top 10 most expensive but useless items in the world 5 survival skills think it is right, but it is completely wrong and can kill you