我在网站上创建了一个新闻版 block 。每行包含 4 张新闻卡片。不知何故,它没有表现得像它应该的那样。那么你能帮我解决这个问题吗。
网站链接:http://www.shmgroup.com/news.php
我无法分享代码。请检查一下。
最佳答案
问题在于图像和文本内容的高度不同。我已经使用以下 CSS 更改更新了网站。 * 为图像添加固定高度而不是宽度,并将其居中对齐。 * 为文本描述添加了 3 行剪辑并添加了最小高度。
.news-thumbnail img {
max-width: 100%;
height: 200px;
display: inline;
}
.news-thumbnail {
margin: 10px;
text-align: center;
}
.news-excert p {
font-size: 14px;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
min-height: 60px;
}
关于html - 自定义布局中的问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53500576/