您好,我是Web开发的新手,请寻求帮助。我创建了这2列(项目1是图像,项目2是文本),在移动视图上,我希望它更改其顺序,以便(项目2位于顶部,项目1位于下方), flex-wrap:反向;但是我想知道我编写的代码是否有可行的方法。
先谢谢您!对不起,这个问题。我只是想寻找另一种方法。 Arigato Gozaimazu !!!
这是链接:https://jsfiddle.net/w2ybd7ax/
获取代码,
HTML:
<div class="grid__items">
<div class="item__1">
<img src="https://via.placeholder.com/457x262" alt="">
</div>
<div class="item__2">
<h2>Block Heading</h2>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
</div>
SCSS:
.grid__items {
margin: 0 auto;
width: 100%;
display: block;
letter-spacing: 0;
font-size: 0;
.item__1 {
margin: 0 auto;
width: 43%;
display: inline-block;
vertical-align: top;
margin: 0% 0 1% 0%;
&.second-grid {
width: 43%;
margin: 0% 0 1% 3%;
}
img {
width: 100%;
}
}
.item__2 {
margin: 0 auto;
width: 54%;
display: inline-block;
margin: 0% 0 1% 3%;
&.second-grid {
width: 54%;
margin: 0% 0 1% 0%;
}
h2 {
margin-top: 0;
margin-bottom: 10px;
font-size: 20px;
font-weight: 600;
letter-spacing: 0.025em;
}
p {
font-size: 16px;
line-height: 1.94;
letter-spacing: 0.025em;
}
}
}
@media screen and (min-width: 320px) and (max-width:767px) {
.grid__items {
margin: 0 auto;
width: 100%;
display: block;
letter-spacing: 0;
font-size: 0;
.item__1 {
margin: 0 auto;
width: 100%;
display: block;
vertical-align: top;
margin: 0% 0 5% 0%;
&.second-grid {
width: 100%;
margin: 0% 0 1% 0%;
}
img {
width: 100%;
}
}
.item__2 {
margin: 0 auto;
width: 100%;
display: block;
margin: 0% 0 1% 0%;
&.second-grid {
width: 100%;
margin: 0% 0 1% 0%;
}
h2 {
margin-bottom: 10px;
font-size: 20px;
font-weight: 600;
letter-spacing: 0.025em;
}
p {
font-size: 16px;
line-height: 1.94;
letter-spacing: 0.025em;
}
}
}
}