gpt4 book ai didi

html - 无法并排对齐两个按钮

转载 作者:行者123 更新时间:2023-11-28 16:16:14 26 4
gpt4 key购买 nike

我添加了 display: inline block ;并尝试过 list-style: none;.但是没有任何效果。我会很感激任何可能的答案。

HTML:

<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;
}

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

最佳答案

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

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;
}

这里我只从 #stuff 中删除了 margin-right: 800px;

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

关于html - 无法并排对齐两个按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58754918/

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