无法并排对齐两个按钮

特例

我添加了 display: inline 块;并尝试过列表样式:none;。然而没有任何效果。我会感谢任何可能的答案。

网址:

<nav class="navbar navbar-light" style="background-color: white; position: fixed; top: 0; width: 
100%; height: 70px; ">

<a href = "index.html">
<h3 id = "title" style="color: #0099ff;">
Student Sources
</h3>
    </a>

<a href = "stuff.html">
<button id = "stuff" style="margin-right: 900px; display:inline-block;">
Articles/Presentations
</button>
    </a>

    <a href = "aboutus.html">
<button id = "aboutus" style="display:inline-block; float: right;a">
About Us
</button>
    </a>

<!-- Navbar content -->
</nav>

CSS:


.navbar navbar-expand-lg navbar-light bg-light{

background-color: blue;
color: blue;
}

#topics{

}
a, a:hover, a:focus {
text-decoration: none;
}


#title{
transition-duration: .1s;
}
#title:hover{
text-decoration: underline;
text-decoration-color: #FFAE00;

}

#stuff{

padding-top: 5px;
padding-bottom: 5px;
padding-left: 10px;
padding-right: 10px;
background-color: white;
color: #0097CF;
border-style: none;
margin-right: 800px;
margin-bottom: 0px; 
color: #0091AE;
transition-duration: .1s;
}

#stuff:hover{


border-style: solid;
border-color:  #FFAE00;
}

#aboutus{
padding-top: 5px;
padding-bottom: 5px;
padding-left: 10px;
padding-right: 10px;
background-color: white;
color: #0097CF;
border-style: none;
margin-right: 800px;
margin-bottom: 0px; 
color: #0091AE;
transition-duration: .1s;
}

#aboutus:hover{

border-style: solid;
border-color:  #FFAE00;
}

如果有人自动说这个问题之前已经回答过,那将是非常令人沮丧的。我试过寻找答案,但它不起作用。

普罗姆·萨卡尔

你没有显示你的链接。我希望你连接了引导程序所需的任务。在这里,我修改了您的代码。

HTML:

<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a href = "index.html"><h3 id = "title" style="color: #0099ff;">Student Sources</h3</a>
<a href = "stuff.html">
<button id = "stuff" style=" display:inline-block;">Articles/Presentations</button>
</a>
<a href = "aboutus.html"><button id = "aboutus" style="display:inline-block;">About Us</button>
</a>

<!-- Navbar content -->
</nav>

在这里,我只删除了margin-right: 900px;float: right部分。

CSS:

.navbar navbar-expand-lg navbar-light bg-light{

background-color: blue;
color: blue;
}

#topics{

}
a, a:hover, a:focus {
text-decoration: none;
}


#title{
transition-duration: .1s;
}
#title:hover{
text-decoration: underline;
text-decoration-color: #FFAE00;

}

#stuff{

padding-top: 5px;
padding-bottom: 5px;
padding-left: 10px;
padding-right: 10px;
background-color: white;
color: #0097CF;
border-style: none;
margin-bottom: 0px; 
color: #0091AE;
transition-duration: .1s;
}

#stuff:hover{


border-style: solid;
border-color:  #FFAE00;
}

在这里,我只删除了margin-right: 800px;from #stuff

这是您的问题的工作小提琴。检查它希望它会帮助你。https://jsfiddle.net/tp43gkvn/2/

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章