css - 使用 jade 和 CSS 将许多图像水平居中

标签 css alignment pug

我知道这个问题已被问过很多次,但没有任何解决方案适合我。我试过 this解决方案,但它对我不起作用,只是将页面左侧的图像对齐。

代码:

head
    link(rel="stylesheet", href="/public/styles/bootstrap.css")
block intro
    .container
        h1(class="text-center") L'équipe
        div(id="images")
            img(alt="aleis", src="/images/team/alexis.jpg", width="160", class="fblogo")
            img(alt="laurent" src="/images/team/laurent.jpg", width="160", class="fblogo")
            img(alt="clement" src="/images/team/clement.jpg", width="160", class="fblogo")
            img(alt="loic" src="/images/team/loic.jpg", width="160", class="fblogo")

最佳答案

这应该可以完成工作:

img{
  width: 300px;
  margin: 5px;
}
#images {
  width: 100%;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-around;
}
<div id="images">
  <img src="https://hd.unsplash.com/photo-1415045550139-59b6fafc832f" alt="">
  <img src="https://hd.unsplash.com/photo-1415045550139-59b6fafc832f" alt="">
  <img src="https://hd.unsplash.com/photo-1415045550139-59b6fafc832f" alt="">
  <img src="https://hd.unsplash.com/photo-1415045550139-59b6fafc832f" alt="">
  <img src="https://hd.unsplash.com/photo-1415045550139-59b6fafc832f" alt="">
</div>

关于css - 使用 jade 和 CSS 将许多图像水平居中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39870140/

相关文章:

javascript - jQuery 显示和隐藏 div

android - 如何更改进度对话框的位置?

html - 水平和垂直居中的响应图像

javascript - 脚本标签内的 Jade 条件语句

javascript - 如何在单击事件期间淡入元素?

javascript - Jade : escape html in mixin argument

html - 图像对齐 - float 后间距不正确

jquery - 使用jQuery改变整个wordpress网站的CSS

javascript - Jquery - 使用来自选择的数据属性更改背景图像

html - 如何正确对齐此 CSS