小编nil*_*338的帖子

如何在父div中水平居中三个div?

我知道这个问题经常被问到,但我似乎永远无法让它发挥作用.你能告诉我什么是错的吗?

我在#container div中有三个div,我想并排放在一起.#container是1000px宽(我希望保持这种方式).这是我的代码:

#container {
  margin-top: 500px;
  position: absolute;
  width: 1000px;
}
.related-article {
  background-color: #D6A400;
  display: inline-block;
  width: 230px;
  height: 300px;
  border-radius: 30px;
  margin-bottom: 0px;
}
.related-article > img {
  width: 200px;
  height: 150px;
  border-radius: 15px;
  margin-top: 15px;
}
.related-article > h3 {
  font-size: 15px;
  width: 180px;
  text-align: justify;
  margin-left: auto;
  margin-right: auto;
  color: #f1f1f1;
  font-family: Abel, serif;
  margin-bottom: none;
}
a {
  text-decoration: none;
}
#right {
  float: right;
}
#left {
  float: left;
}
#center {
  margin-left: …
Run Code Online (Sandbox Code Playgroud)

html css

21
推荐指数
2
解决办法
1360
查看次数

标签 统计

css ×1

html ×1