当前位置:网站首页>A brief talk on media inquiry
A brief talk on media inquiry
2022-06-25 05:02:00 【Dai Sensen】
Definition and use
1. Use @media Inquire about , You can define different styles for different media types .
[email protected] You can set different styles for different screen sizes , Especially if you need to design responsive pages ,@media It's very useful .
3. When you reset the size of the browser , The page also re renders the page based on the width and height of the browser .
Grammar and usage
@media mediatype and|not|only (media feature) {
CSS-Code;
}
<style> /* We fit on the screen and the maximum width 800 Pixels */ @media screen and (max-width:800px) {
body {
background-color: plum; } } @media screen and (max-width:500px) {
body {
background-color: pink; } } </style>
</head>
<body>
<div></div>
</body>
attribute
Media type
value | describe |
---|---|
all | For all equipment |
For printers and print previews | |
screen | For computer screen , The tablet , Smart phones and so on . |
– | – |
Media functions
value | describe |
---|---|
min-width | Define the minimum visible area width of the page in the output device . |
max-width | Define the maximum visible area width of the page in the output device . |
– | – |
key word
and, You can connect multiple media features together , Equivalent to and means
not, Exclude a media type , Equivalent to non means , Negligible
only Know specific media types , You can ignore
usage
Media query +rem Implement dynamic size change of elements
rem The unit is to follow html Walking up and down , With rem Page elements can be set in different sizes
Media lookup can change the style according to different device widths
Media query +rem You can achieve different device widths , Realize the dynamic change of page element size
eg:
* {
margin: 0;
padding: 0;
}
/* Order from small to large */
@media screen and (min-width:320px) {
html {
font-size: 50px;
}
}
@media screen and (min-width:640px) {
html {
font-size: 100px;
}
}
.top {
height: 1rem;
font-size: .5rem;
background-color: green;
color: #fff;
text-align: center;
line-height: 1rem;
}
</style>
</head>
<body>
<div class="top"> The shopping cart </div>
</body>
边栏推荐
- 电脑的dwg文件怎么打开
- Penetration test - directory traversal vulnerability
- Route parameters to jump to the page and transfer parameters -- > hidden parameter list
- buuctf(re)
- 【FLink】access closed classloader classloader.check-leaked-classloader
- [keil] GPIO output macro definition of aducm4050 official library
- 2021-03-23
- Implementation of websocket long connection by workman under laravel
- Compatible with Internet Explorer
- CTFHub-rce
猜你喜欢
Two hours to take you into the software testing industry (with a full set of software testing learning routes)
Svg code snippet of loading animation
buuctf(re)
In Net 6 using dotnet format formatting code
Separation of storage and computing in Dahua cloud native database
leetcode1221. Split balance string
Summary of SQL injection (I)
Difference between asemi high power FET and triode
olap分析引擎——Kylin4.0
Attack and defense world web baby Web
随机推荐
dotnet-exec 0.4.0 released
Implementation of websocket long connection by workman under laravel
The SQL response is slow. What are your troubleshooting ideas?
Eyeshot 2022 Released
Summary of SQL injection (I)
How to download and use Xiaobai one click reload on the official website
Qdebug June 2022
Working principle of asemi three-phase rectifier bridge
The print area becomes smaller after epplus copies the template
Successfully solved: selenium common. exceptions. TimeoutException: Message: timeout: Timed out receiving message from
What is Ethernet and how to connect the computer
Teach you to write non maintainable PHP code step by step
Why is the TCP handshake just 3 times?
为什么SQL语句命中索引比不命中索引要快?
【Flink】RocksDB增量模式checkpoint大小持续增长的问题及解决
Svg code snippet of loading animation
parallel recovery slave next change & parallel recovery push change
Student achievement management system based on SSH
OOP vector addition and subtraction (friend + copy construction)
Codeforces Round #802 (Div. 2) C D