当前位置:网站首页>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>

边栏推荐
- Kotlin compose listens to the soft keyboard and clicks enter to submit the event
- Wechat applet new version prompt update
- Why PHP is not safe
- Startup mode of SoC verification environment
- buuctf(pwn)
- 两小时带你进入软件测试行业风口(附全套软件测试学习路线)
- olap分析引擎——Kylin4.0
- CSRF (Cross Site Request Forgery) &ssrf (server request forgery) (IV)
- Why does the SQL statement hit the index faster than it does not?
- "Daily practice, happy water" 1108 IP address invalidation
猜你喜欢

在 .NET 6 中使用 dotnet format 格式化代码

Records of ros2/dds/qos/ topics

dotnet-exec 0.4.0 released

Matlab notes

The construction and usage of wampserver framework

dotnet-exec 0.4.0 released

How to download and use Xiaobai one click reload on the official website

固態硬盤開盤數據恢複的方法
Triangle class (construction and deconstruction)

高效的NoSQL数据库服务Amozon DynamoDB体验分享
随机推荐
Native JS high risk reminder pop-up code snippet, "are you sure you want to do this?" and "it cannot be recovered after deletion. Do you want to continue“
Vscade setting clang format
Calculate student grade (virtual function and polymorphism)
ThinkPHP 5 log management
buuctf(pwn)
There is 404 in the laravel visit, except the home page is redirected; Index php
Excel exports data to SQL and pictures to folder through macro | VBA
Sleep more, you can lose weight. According to the latest research from the University of Chicago, sleeping more than 1 hour a day is equivalent to eating less than one fried chicken leg
Swift rapid development
高效的NoSQL数据库服务Amozon DynamoDB体验分享
ORA-00800: soft external error
执行SQL响应比较慢,你有哪些排查思路?
Why PHP is not safe
固态硬盘开盘数据恢复的方法
February 20ctf record
buuctf(re)
How to open the DWG file of the computer
After the newly assigned variable of the applet is modified, the original variable will also be modified
Kotlin Compose 完善toDo项目 Surface 渲染背景 与阴影
buuctf web