图像不能正确对齐中心

时间:2016-04-05 01:04:22

标签: html css github alignment github-pages

抱歉,如果这是一个简单或愚蠢的问题。

基本上我正试图对齐我页面上的所有图像,但是对齐方式不能正常工作,你可以在site here上看到。这是我用于三个主要部分的CSS。它们对齐中心,但它们使用每个图像的左侧,而不是图像的中间是焦点。

.links {
position: fixed;
text-align: center;
top: 50%;
left: 50%;
}
.footer {
position: fixed;
text-align: center;
top: 75%;
left: 50%;
}
.header {
position: fixed;
text-align: center;
top: 25%;
left: 50%;
}

由于无法发布超过2个链接,如果您需要了解更多内容,可以在此处找到 nikki.html style.css :{{ 3}}

我尝试将左边的百分比更改为自己手动执行,但这使得网站在不同的事情上显示奇怪。谢谢你的帮助。

2 个答案:

答案 0 :(得分:0)

您可以对display: block内的img尝试:div 这将允许您水平居中。

您使用的是Bootstrap吗?

答案 1 :(得分:0)

你可以试试这个

.center-custom {
  display: block;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

然后将class =“center-custom”属性放在img元素中。

相关问题