当前位置:网站首页>Responsive page
Responsive page
2022-07-24 06:30:00 【PS notes】
The same set of static page code , Show different effects in different devices , And it can adapt
Monitor terminal equipment .
Media query
adopt @media Definition of style , The browser window meets the specified conditions , Will Yin use this style .
.box{
width:200px;
height:200px;
background-color:red;
}
Less than the specified width , Style works
@media screen and (max-width:600px){
background-color:blue;
}
</head>
<style>
.box{
width: 100px;
height: 100px;
background-color: yellow;
}
@media screen and (max-width:600px) {
.box{
width: 200px;
height: 200px;
background-color: red;
}
}
</style>
<body>
<div class="box"></div>
</body>
</html>
You can also set multiple conditions :
@media screen and (min - width:600px ) and (max-width:900px){
.box{
background-color:blue;
}
}
</head>
<style>
.box{
width: 100px;
height: 100px;
background-color: yellow;
}
@media screen and (min-width: 600px) and (max-width: 900px) {
.box{
width: 200px;
height: 200px;
background-color: red;
}
}
</style>
<body>
<div class="box"></div>
</body>
</html>Make a case :
<style>
.container{
display: flex;
width: 800px;
margin:0 auto;
background-color: #eee;
justify-content: center;
}
.item{
width: 200px;
border: 1px solid red;
}
@media screen and ( max-width: 700px) {
.container {
width: 100%;
flex-direction:column;
}
}
.item{
width: 100%;
}
</style>
<body>
<div class="container">
<div class="item">
<h1> file </h1>
</div>
<div class="item">
<h1> Blog </h1>
</div>
<div class="item">
<h1> video </h1>
</div>
</div>
</body>
</html>

Advantages and disadvantages of responsive pages
advantage : A set of pages is suitable for multi terminal devices , Improve development efficiency
shortcoming : The page effect is not the page effect of one end alone , Performance issues , Maintenance costs are high
summary : Most projects will not have a responsive solution as a whole .
边栏推荐
- grep与正则的搭配使用
- 迭代器与生成器
- Top 10 vulnerability assessment and penetration testing tools
- IP作业(2)RIP
- Crud of MySQL
- Pycharm set code template
- IP job (6)
- SSH远程访问及控制
- Leetcode refers to offer jz5 to replace the space string
- [award issuance] the results of the first essay solicitation activity in oneos zone were announced
猜你喜欢
随机推荐
leetcode剑指offer JZ73 翻转单词序列
Li Kou 986. Intersection of interval lists
[222] memory overflow and location
Custom MVC 2.0
history命令历史记录中加时间
【214】什么是自动化框架
mysql 忘记退出直接关闭窗口现在要删除整个文件夹如何删除
Maximum value of jz47 gifts (dynamic planning ideas)
Interview questions for Test Manager / test team leader / Test Supervisor
Server hardware and RAID configuration practice
Flink time stream processing
Flink checkpoint configuration details
A batch of interview questions and answers_ 20180403 latest arrangement
进行挂载永久挂载后无法开机
Data warehouse and data warehouse modeling
Metersphere one stop open source continuous testing platform
UE4 reload system 1. basic principle of reload system
联合国农产品数据分析
【测试工具】
Leetcode sword finger offer jz73 flip word sequence








