gpt4 book ai didi

javascript - 为什么我的圆形按钮从 Bootstrap 3 转到 Bootstrap 4 时会损坏?

转载 作者:行者123 更新时间:2023-12-02 22:53:41 25 4
gpt4 key购买 nike

我有以下 fiddle :

https://jsfiddle.net/b3x6ou4k/

当我将 CSS 链接从 Bootstrap 3 更改为 Bootstrap 4(使用 https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css 作为 CSS)时,圆形按钮变为方形。

为什么圆形按钮的 CSS 是这样的:

.btn-circle {
width: 30px;
height: 30px;
text-align: center;
padding: 6px 0;
font-size: 12px;
line-height: 1.428571429;
border-radius: 15px;
}

在 Bootstrap 4 中不起作用,我如何保持这种风格:

enter image description here

而不是这种风格:

enter image description here

什么时候从 3 升级到 4?

最佳答案

您需要咨询migration docs ,但这似乎接近您之前的情况: https://jsfiddle.net/xrcu92bo/1/

<div class="container">
<div class="stepwizard">
<div class="stepwizard-row setup-panel">
<div class="stepwizard-step col-xs-3">
<a href="#step-1" type="button" class="btn btn-success btn-circle">1</a>
<p><small>Shipper</small></p>
</div>
<div class="stepwizard-step col-xs-3">
<a href="#step-2" type="button" class="btn border btn-light btn-circle" disabled="disabled">2</a>
<p><small>Destination</small></p>
</div>
<div class="stepwizard-step col-xs-3">
<a href="#step-3" type="button" class="btn border btn-light btn-circle" disabled="disabled">3</a>
<p><small>Schedule</small></p>
</div>
<div class="stepwizard-step col-xs-3">
<a href="#step-4" type="button" class="btn border btn-light btn-circle" disabled="disabled">4</a>
<p><small>Cargo</small></p>
</div>
</div>
</div>

<form role="form">
<div class="panel panel-primary setup-content" id="step-1">
<div class="panel-heading">
<h3 class="panel-title">Shipper</h3>
</div>
<div class="panel-body">
<div class="form-group">
<label class="control-label">First Name</label>
<input maxlength="100" type="text" required="required" class="form-control" placeholder="Enter First Name" />
</div>
<div class="form-group">
<label class="control-label">Last Name</label>
<input maxlength="100" type="text" required="required" class="form-control" placeholder="Enter Last Name" />
</div>
<button class="btn btn-primary nextBtn pull-right" type="button">Next</button>
</div>
</div>

<div class="panel panel-primary setup-content" id="step-2">
<div class="panel-heading">
<h3 class="panel-title">Destination</h3>
</div>
<div class="panel-body">
<div class="form-group">
<label class="control-label">Company Name</label>
<input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Name" />
</div>
<div class="form-group">
<label class="control-label">Company Address</label>
<input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Address" />
</div>
<button class="btn btn-primary nextBtn pull-right" type="button">Next</button>
</div>
</div>

<div class="panel panel-primary setup-content" id="step-3">
<div class="panel-heading">
<h3 class="panel-title">Schedule</h3>
</div>
<div class="panel-body">
<div class="form-group">
<label class="control-label">Company Name</label>
<input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Name" />
</div>
<div class="form-group">
<label class="control-label">Company Address</label>
<input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Address" />
</div>
<button class="btn btn-primary nextBtn pull-right" type="button">Next</button>
</div>
</div>

<div class="panel panel-primary setup-content" id="step-4">
<div class="panel-heading">
<h3 class="panel-title">Cargo</h3>
</div>
<div class="panel-body">
<div class="form-group">
<label class="control-label">Company Name</label>
<input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Name" />
</div>
<div class="form-group">
<label class="control-label">Company Address</label>
<input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Address" />
</div>
<button class="btn btn-success pull-right" type="submit">Finish!</button>
</div>
</div>
</form>
</div>

基本上,.btn-default 在 Bootstrap 4 中不存在;您得到的最接近的是.btn-light。我还添加了 .border 类,因为灯光按钮与背景没有太多对比度。

此外,disabled 属性 doesn't actually do anything on an anchor tag - 如果您想阻止用户点击“禁用”步骤,则需要使用 disabled 类。

关于javascript - 为什么我的圆形按钮从 Bootstrap 3 转到 Bootstrap 4 时会损坏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58088844/

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