我为我糟糕的英语提前道歉,如果不是这样的话))。
你好,我需要帮助,如何移动块时,缩放为手机。
目前,如果缩小屏幕,它们只是略微缩小。
以下是在扩展时应该如何迁移它们的example。
请提前谢谢您的帮助。
以下是该网站的区块布局代码:
.section {
position: absolute;
z-index: 0;
width: 50%;
height: 50%;
overflow: hidden;
-webkit-transform: scale(1);
transform: scale(1);
will-change: transform;
-webkit-transition-property: all;
transition-property: all;
-webkit-transition-duration: 300ms;
transition-duration: 300ms;
-webkit-transition-timing-function: ease-in-out;
transition-timing-function: ease-in-out;
}
.section:first-child {
top: 0;
left: 0;
background: #F06060;
}
.section:nth-child(2) {
top: 0;
left: 50%;
background: #FA987D;
}
.section:nth-child(3) {
top: 50%;
left: 0;
background: #72CCA7;
}
.section:nth-child(4) {
top: 50%;
left: 50%;
background: #10A296;
}
.section.is-expanded {
top: 0;
left: 0;
z-index: 1000;
width: 100%;
height: 100%;
}
.has-expanded-item .section:not(.is-expanded) {
-webkit-transform: scale(0);
transform: scale(0);
opacity: 0;
}
.section.is-expanded {
visibility: visible;
opacity: 1;
-webkit-transition: opacity 200ms linear 300ms;
transition: opacity 200ms linear 300ms;
}
.demo-box {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
height: 100%;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
color: #fff;
font-size: 2rem;
font-weight: 300;
}<main class="main">
<section class="section">
<div class="demo-box">Section 1</div>
</section>
<section class="section">
<div class="demo-box">Section 2</div>
</section>
<section class="section">
<div class="demo-box">Section 3</div>
</section>
<section class="section">
<div class="demo-box">Section 4</div>
</section>
</main>
发布于 2018-02-10 22:16:00
@media only screen and (max-width:480)
{
.section {
width: 100%;
height: 50%;
float:left;
}
}试试这个,我觉得很有用。
https://stackoverflow.com/questions/48721599
复制相似问题