gpt4 book ai didi

html - 将按钮放在输入框内

转载 作者:太空宇宙 更新时间:2023-11-04 16:25:12 24 4
gpt4 key购买 nike

我有什么

<form class="input-group-1 well" id="spinner-form">
<input id="input1" class="form-control" type="text">
<a class="btn" id="up-button">
<span class="glyphicon glyphicon-chevron-up"></span>
</span>
<a class="btn" id="down-button">
<span class="glyphicon glyphicon-chevron-down" ></span>
</a>
</form>

它的样子:

enter image description here

我想要的:

enter image description here

我用的是bootstrap,下面是一些重写的​​样式

   <style>
.input-group-1 {
width: 300px;
margin-bottom: 50px;
}
a {
color: #737577;
}
</style>

我不确定如何编辑 css 来获得它,请帮忙!!

谢谢

最佳答案

像这样:

jsFiddle

这是相关的 CSS/HTML

HTML

<div class="input-stack">
<input id="input1" class="form-control" type="text" />
<a class="btn" id="up-button">
<span class="glyphicon glyphicon-chevron-up">^</span>
<a class="btn" id="down-button">
<span class="glyphicon glyphicon-chevron-down">v</span>
</a>
</div>

CSS

.input-stack {
display: inline-block;
position: relative;
}
.input-stack input {
padding: 4px;
height: 22px;
line-height: 22px;
font-size: 16px;
border: solid 1px #999;
border-radius: 2px;
}
a.btn {
position: absolute;
right: 5px;
z-index: 2;
}
#up-button {
top: 2px;
}
#down-button {
bottom: 2px;
}

关于html - 将按钮放在输入框内,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25878745/

24 4 0