Dra*_*gan 47 twitter-bootstrap twitter-bootstrap-4 bootstrap-4
我刚刚迁移到bootstrap 4,我的xs按钮似乎不再特别小!
查看bootstrap 4中按钮的文档,我没有看到额外的小按钮选项?
谁能为我证实这一点?
谢谢!
alo*_*ica 43
如果它可以帮助某人,@ rifton007快速解决了问题.在您的css文件中添加:
.btn-group-xs > .btn, .btn-xs {
padding: .25rem .4rem;
font-size: .875rem;
line-height: .5;
border-radius: .2rem;
}
Run Code Online (Sandbox Code Playgroud)
演示:
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet"/>
<style>
.btn-group-xs > .btn, .btn-xs {
padding: .25rem .4rem;
font-size: .875rem;
line-height: .5;
border-radius: .2rem;
}
</style>
<button class="btn btn-primary btn-xs">?</button>
<button class="btn btn-primary btn-sm">?</button>
<button class="btn btn-primary">?</button>
<button class="btn btn-primary btn-lg">?</button>
Run Code Online (Sandbox Code Playgroud)
Bas*_*sen 12
是的,btn-xs
在Bootstrap 4中没有,你必须自己创建这个类.在scss/mixins/_buttons.scss
你会发现称为混入button-size
所以你SCSS代码使用下面的代码:
.btn-xs {
// line-height: ensure proper height of button next to extra small input
@include button-size($padding-y, $padding-x, $font-size, $line-height, $border-radius);
}
Run Code Online (Sandbox Code Playgroud)
squ*_*hel 10
你需要定义你自己的xs样式和变量,这对我来说最匹配,接近bootstrap 3 btn-xs大小:
Bootstrap 4 Alpha
$btn-padding-x-xs: .38rem !default;
$btn-padding-y-xs: .18rem !default;
.btn-xs {
@include button-size($btn-padding-y-xs, $btn-padding-x-xs, $font-size-sm, $btn-border-radius-sm);
}
Run Code Online (Sandbox Code Playgroud)
Bootstrap 4 Beta 2
$btn-padding-x-xs: .20rem !default;
$btn-padding-y-xs: .12rem !default;
$input-btn-line-height-xs: 1.1 !default;
.btn.btn-xs {
// line-height: ensure proper height of button next to small input
@include button-size($btn-padding-y-xs, $btn-padding-x-xs, $font-size-sm, $input-btn-line-height-xs, $btn-border-radius-sm);
}
Run Code Online (Sandbox Code Playgroud)
小智 7
我从旧版本的 Bootstrap 中提取了 CSS。您可以在自定义样式表中使用下面提到的 CSS 样式。在名为 btn-xs 的类的帮助下,您可以使用旧的按钮样式。
祝你好运。
button
{
margin-top: 10px;
margin-left: 10px;
}
.btn-xs
{
padding: 1px 5px !important;
font-size: 12px !important;
line-height: 1.5 !important;
border-radius: 3px !important;
}
Run Code Online (Sandbox Code Playgroud)
<link rel="stylesheet" href="https://v4-alpha.getbootstrap.com/dist/css/bootstrap.min.css">
<button class="btn btn-primary btn-xs">This is Small Button</button>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
24464 次 |
最近记录: |