【发布时间】:2021-02-07 02:39:11
【问题描述】:
我正在寻找线索来设计一个类似本页顶部的横幅:https://www.gazteaukera.euskadi.eus/inicio/
我正在尝试自己,但没有得到我想要的(见下文)。我希望左侧的图像列和右侧的文本列完全对齐。我希望它具有响应性,以便在较小的屏幕中,左列将放置在右列的顶部(顶部和底部 div 之间没有空格)。
我在获得我想要的东西时遇到了一些问题。我希望有人可以帮助我:)
代码:
.row {
background-color: blue;
padding: 0px;
/*I have added a background-color to help me solve the design issues, but this is sthg to be removed*/}
.column {
float: left;
width: 50%;
padding: 0px;
}
.row:after {
content: "";
display: table;
clear: both;
}
.title {
font-size: 24px;
color: #0FD955;
padding: 15px 15px 0px 15px;
font-weight: bold;}
.text {
font-size: 18px;
color: #0FD955;
padding: 0px 15px 15px 15px;
}
.imgw100 {
width: 100%;
}
@media screen and (max-width: 980px) {
.column { width: 100%; }
.right { width: 100%; }
.left { width: 100%; }
}
<div class="row">
<div class="column right">
<img class="imgw100" src="https://butterfly-conservation.org/sites/default/files/styles/masthead/public/2019-03/16548509661_3bdddd5179_o.jpg" />
</div>
<div class="column left" style="background-color: #022C11;">
<p class="title">Breaking news</p>
<p class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
【问题讨论】:
标签: html css media-queries