【发布时间】:2020-02-16 12:17:36
【问题描述】:
我无法按照我想要的方式对齐照片
我正在尝试构建一个代码,其中我可以在左侧有一张大照片,然后在右侧有三张小图片(虽然它们都在中心对齐)但三张小图片最终会转到底部
这是CSS
.topnews{
}
.featurednews {
text-align: center;
left: 50%;
top: 50%;
}
.featurednews img {
width: 700px;
height: 400px;
padding: 10px;
border: 1px solid #233988;
position: ralative;
left: 50%;
top: 50%;
}
.otherfeaturednews{
text-align: center;
}
.otherfeaturednews img{
display: inline-block;
width: 200px;
height: 100px;
padding: 6px;
position: relative;
float: center;
}
<pre>
<code>
<html>
<div class="topnews">
<div class="featurednews"><img src="https://images.pexels.com/photos/1402787/pexels-photo-1402787.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="random image"></div>
<div class="otherfeaturednews"><img src="https://images.pexels.com/photos/1402787/pexels-photo-1402787.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="image at the side">
<div class="otherfeaturednews"><img src="https://images.pexels.com/photos/1402787/pexels-photo-1402787.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="image at the side">
<div class="otherfeaturednews"><img src="https://images.pexels.com/photos/1402787/pexels-photo-1402787.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="image at the side">
</div>
</div>
</div>
</div>
</html>
页面的左中应该有一张大照片,右中应该有三张小照片。请帮忙。试了很多方法,都不管用。
这就是它的显示方式 What I have done
这就是它应该的样子。 how I want it to look like
【问题讨论】: