水平div中的居中元素

时间:2018-09-05 17:37:29

标签: html css

您好,如何将徽标,导航栏等元素在div中居中对齐?

我使用了position:relative,并优先考虑顶部,底部优先级,直到看起来居中。enter image description here

徽标:

.logo{
float:left;
position:relative;
top:28px;
left:25px;
font-size:25px;
border:1px solid black;
padding:5px 15px;
border-radius:7px;
}

导航:

nav{
float:right;
position:relative;
top:31px;
}

2 个答案:

答案 0 :(得分:0)

基本上,如果需要对齐中心位置,则使用:

text-align:center;

您描述一个相对位置,并加上一个浮点数。我们将需要HTML设置和CSS来了解正在发生的事情。

答案 1 :(得分:0)

brew uninstall --force R

请参阅此great guide

相关问题