gpt4 book ai didi

html - 将 div 与 "position: fixed"居中对齐

转载 作者:太空宇宙 更新时间:2023-11-03 23:37:38 25 4
gpt4 key购买 nike

我有以下标记:

<body>
<ul class="navigation">
<li><a href="#">Bucuresti</a></li>
<li><a href="#">Sighisoara</a></li>
<li><a href="#">Tuzla</a></li>
<li><a href="#">Comorova-Neptun</a></li>
<li><a href="#">Maramures</a></li>
<li><a href="#">Sinaia</a></li>
</ul>
</body>

和 CSS:

body {
padding-top: 0;
padding-bottom: 0;
margin: 0;
text-align: center;
background-color: #5A1560;
min-height: 100%;
}
ul.navigation {
height: 30px;
line-height: 30px;
position: fixed;
bottom: 0;
width: 960px;
margin-left: auto;
margin-right: auto;
background-color: #D3EC60;
margin-bottom: 0;
margin-top: 0;
padding: 0;
border: 1px solid #000000;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}

我的页面如下所示:

enter image description here

我想您已经猜到底部的 div(ul.navigation)应该位于页面的中央。我哪里错了?

最佳答案

left:0;right:0; 添加到 ul.navigation

关于html - 将 div 与 "position: fixed"居中对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23639603/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com