【问题标题】:centering menu in different resolutions不同分辨率的居中菜单
【发布时间】:2012-10-24 01:56:58
【问题描述】:

http://www.mammacoil.com/

我正在努力使这个菜单居中,我尝试了边距自动 css,但它似乎没有工作。有人可以帮忙吗。

将其设置为 100% 然后自动保证金会更容易吗?

#access {
clear: both;
margin-top: -20%;;
margin-left: 15%;
width: 100%;
font-family: SansitaOne;
font-weight: 100;
text-shadow: 2px 2px #000000;
height: 43px;
text-align: center;

}
#access ul {
font-size: 18px;
list-style: none;
}
#access li {
position: relative;
float: left;
}

提前谢谢你。

科斯蒂

【问题讨论】:

标签: css margin centering


【解决方案1】:

您可以通过margin:0 auto; 执行此操作,它适用于所有分辨率

并设置宽度

#access {
    clear: both;
    font-family: SansitaOne;
    font-weight: 100;
    height: 43px;
    margin: 0 auto;
    text-shadow: 2px 2px #000000;
    width: 960px;              <-----set this
}

【讨论】:

  • 嗨空指针,我试过了,它仍然没有居中访问 div 内容:S
  • @KirstyHarris 在#access div 上尝试`text-align: center;`
  • @Nullpointer...它已经在上面的#access中了?
  • 看到它现在已将其设置在菜单 bk 下方,而不是我想要的位置:S
  • 边距:0 自动;不工作,因为 width:100% 使用 width:960px 和 margin:0 auto;
猜你喜欢
  • 2016-06-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-06-20
  • 1970-01-01
  • 2011-01-02
  • 1970-01-01
  • 2015-03-09
相关资源
最近更新 更多