gpt4 book ai didi

html - 文本输入之间的垂直线

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

我正在尝试创建一个搜索框:一个文本框和一个下拉列表显示为由一条小垂直线分隔的单个元素。如下图所示。我专注于实现“名称”和“地点”之间的垂直线 enter image description here

我正在尝试通过 html 中的 css 实现它。我试图将“名称”文本框的右边框显示调整为可见,并删除所有其他边框。

<!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.4.0/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.4.0/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">

<form>
<div class="form-group" style="display:flex; background-color: ;">
<input type="text" class="form-control" style="border:none; border-right: 1px solid black; border-radius:50px;">
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" style="background-color: white; color:black; border:none">Dropdown Example
<span class="caret"></span></button>
<ul class="dropdown-menu" style="background-color: white;">
<li><a href="#">HTML</a></li>
<li><a href="#">CSS</a></li>
<li><a href="#">JavaScript</a></li>
</ul>
</div></div>
</form>
</div>

</body>
</html>

但它不起作用。因为我的文本框需要圆 Angular ,所以对我来说似乎很难实现。还有其他技术可以解决这个问题吗?我怎样才能使 View 符合预期?请帮忙。提前致谢。

最佳答案

检查更新的更改

border-radius:50px 0px 0px 50px;

行使用

.dropdown:before{
position:absolute;
content:'';
left:0px;
height:28px;
width:2px;
background:#000000;
top:3px;
}

.dropdown .btn{
height:34px;
}

.form-group input:focus,.form-group .dropdown:focus,.form-group button:focus{
outline:0px;
box-shadow: none;
}



.dropdown:before{
position:absolute;
content:'';
left:0px;
height:28px;
width:2px;
background:#000000;
top:3px;
}
<!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.4.0/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.4.0/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">

<form>
<div class="form-group" style="display:flex; background-color:#000000; height:40px; padding:3px 0px;">
<input type="text" class="form-control" style="border:none; border-radius:50px 0px 0px 50px;">
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" style="background-color: white; color:black; border:none; border-radius:0px;">Dropdown Example
<span class="caret"></span></button>
<ul class="dropdown-menu" style="background-color: white;">
<li><a href="#">HTML</a></li>
<li><a href="#">CSS</a></li>
<li><a href="#">JavaScript</a></li>
</ul>
</div>
<button class="btn btn-primary" type="button" data-toggle="dropdown" style="background-color: green; color:white; border:none; border-radius:0px 50px 50px 0px;">icon
</div>
</form>
</div>

</body>
</html>

关于html - 文本输入之间的垂直线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55217988/

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