gpt4 book ai didi

jquery - Bootstrap 中输入字段的边框

转载 作者:行者123 更新时间:2023-12-01 08:39:51 25 4
gpt4 key购买 nike

我需要输入元素的边框,如下图所示:

enter image description here

但是使用以下代码得到了不同的结果。有人可以帮我得到这个吗?

<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
.input-number{
width: 25px !important;
margin: 0 5px;
font-size: 25px;
border-bottom:2px solid #000;
text-align: center;
vertical-align: bottom;
}
</style>
</head>
<body>
<div style="width:150px;padding:50px;">
<input type="text" class="input-number" value="0"/>
</div>
</body>
</html>

最佳答案

您可以按如下方式创建自定义边框框:

HTML:

<input type="text" class="input-number" value="0"/>
<div class="borderbox"></div>

CSS:

.input-number {
width: 25px !important;
margin: 0 5px;
font-size: 25px;
border: none;
text-align: center;
vertical-align: bottom;
}
.input-number:focus {
border:none;
outline:none;
}
.borderbox {
border: 2px solid #000;
border-top: none;
width: 30px;
height:10px;
margin-top: -8px;
margin-left: 3px;
}

Codepen 引用链接: https://codepen.io/YasirKamdar/pen/vdeRWw

关于jquery - Bootstrap 中输入字段的边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48801050/

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