我正在尝试改编我为移动/平板电脑查看而构建的网站。我现在有三个图像&撇开'对',其中每个的布局从左侧的图像改变到右侧,然后在右侧和左侧的图像。为响应式布局重新定位并排元素
我现在想调整这一点,以便在移动布局的每个相应的图像下方的旁边部分。我遇到了一些困难,所以希望能够实现我想要的布局的最佳实践。
下面是相应的代码片段。 (空白空间是图像出现在那里。)
.about-text {
padding: 5% 5% 0 5%;
}
.def-width {
width: 50%;
}
.table {
display: table;
}
#experience article {
float: left;
}
#experience aside {
float: right;
}
#gas-safe article {
float: left;
}
#gas-safe aside {
float: right;
}
#gas-safe a {
color: #4E6E9B;
border-bottom: 1px dotted #4E6E9B;
}
#quality article {
float: left;
}
#quality aside {
float: right;
}
#to-top {
display: block;
text-align: center;
text-decoration: none;
color: #4E6E9B;
}
#to-top i {
font-size: 50px;
text-align: center;
}
#to-top:hover {
color: #fff;
}
<div class="alt-color">
<section class="table" id="experience">
<article class="def-width">
<img src="img/boiler-commission-scaled.jpg" class="about-img">
</article>
<aside class="about-text def-width">
<h2>34 Years Experience</h2>
<p>Wayne is proud to have 34 years of experience in the gas engineering industry after having formerly completed a 3 year apprenticeship with British Gas.</p>
</aside>
</section>
<section class="table" id="gas-safe">
<article class="about-text def-width">
<h2>Gas Safe Accredited</h2>
<p>Safety always comes first. That's why we are trained to conform with the latest 'Gas Safe Register' standards.
</p><br>
<a href="https://www.gassaferegister.co.uk/find-an-engineer/check-a-business/?id=Wk%2biWbZCWcWz04dI3rDbQA%3d%3d" target="_blank">Check our Gas Safe Registration</a>
</article>
<aside class="def-width">
<img src="img/radiator-fitting-scaled.jpg" class="about-img">
</aside>
</section>
<section class="table" id="quality">
<article class="def-width">
<img src="img/gas-engineer-scaled.jpg" class="about-img">
</article>
<aside class="about-text def-width">
<h2>Quality. Without Compromise.</h2>
<p>Your central heating system is a big investment. We promise to only use industry leading products and install these with quality in mind; no corner cutting.</p>
</aside>
</section>
<a id="to-top" href="index.html">
<i class="fa fa-arrow-circle-up"></i>
</a>
</div>
你想使用[CSS @media查询(https://www.w3schools.com/css/css_rwd_mediaqueries.asp)为更好的RWD – cometguy
当你谈论响应式设计,你应该使用bootstrap! –
目前还不清楚你想做什么... – DaFois