gpt4 book ai didi

css - 带有垂直分隔符 css 的按钮

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

我试图在图标和按钮上的一些文本之间添加一个垂直分隔符,但它只是将所有内容都往下推。这是为什么?

.btn {
height: 22px;
border: 1px solid #B9B9B9;
font-weight: normal;
font-size: 11px;
color: #003E7E;
text-align: left;
line-height: 12px;
width: 200px;
}
.separator {
content: '';
display: inline-block;
background: #888;
margin: 0px 4px;
height: 18px;
width: 1px;
}
<link href="http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet"/>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet"/>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<button type="button" class="btn">
<span class="icon-plus"></span>
<span class="separator"></span>
ABC0102165
</button>

最佳答案

我会添加“padding-top: 0px !important;”到 .btn,和“垂直对齐:顶部;”到.separator.

.btn {
height: 22px;
border: 1px solid #B9B9B9;
font-weight: normal;
font-size: 11px;
color: #003E7E;
text-align: left;
line-height: 12px;
width: 200px;
padding-top: 0px !important;
}
.separator {
content: '';
display: inline-block;
background: #888;
margin: 0px 4px;
height: 18px;
width: 1px;
vertical-align: top;
}
<link href="http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet"/>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet"/>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<button type="button" class="btn">
<span class="icon-plus"></span>
<span class="separator"></span>
ABC0102165
</button>

关于css - 带有垂直分隔符 css 的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27551928/

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