[英]Bootstrap button padding not loading
I'm trying to get some buttons to work in Bootstrap 5:我试图让一些按钮在 Bootstrap 5 中工作:
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet" /> <div class="container-fluid"> <div class="row"> <div class="col-12"> <a class="btn-primary">0000</a> <button class="btn-primary">0000</button> </div> </div> </div>
But the styles aren't being applied correctly, the buttons appear to be missing the rounded corners and the padding:但是 styles 没有正确应用,按钮似乎缺少圆角和填充:
I'm only loading the styles from <link href="css/bootstrap.min.css" rel="stylesheet">
which I'm pretty sure is what I always do.我只从
<link href="css/bootstrap.min.css" rel="stylesheet">
加载 styles,我很确定这是我一直在做的。
Change class class="btn-primary" to class="btn btn-primary"将 class class="btn-primary" 更改为 class="btn btn-primary"
Need to btn
align with other custom bootstrap classes.需要
btn
与其他自定义引导类对齐。 Read about buttons here在此处阅读有关按钮的信息
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet"/> <div class="container-fluid"> <div class="row"> <div class="col-12"> <a class="btn btn-primary">0000</a> <button class="btn btn-primary">0000</button> </div> </div> </div>
It misses the "btn" class.它错过了“btn”class。
<a href="#" class="btn btn-primary">asdasda</a>
you forgot the btn
class你忘了
btn
class
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet" /> <div class="container-fluid"> <div class="row"> <div class="col-12"> <a class="btn btn-primary" role="button">0000</a> <button class="btn btn-primary">0000</button> </div> </div> </div>
https://getbootstrap.com/docs/4.5/components/buttons/
https://getbootstrap.com/docs/4.5/components/buttons/
Bootstrap includes several predefined button styles, each serving its own semantic purpose, with a few extras thrown in for more control.
Bootstrap 包含几个预定义的按钮 styles,每个按钮都有自己的语义用途,并添加了一些额外功能以进行更多控制。
Button tags
按钮标签
The
.btn
classes are designed to be used with the<button>
element..btn
类旨在与<button>
元素一起使用。 However, you can also use these classes on<a>
or<input>
elements (though some browsers may apply a slightly different rendering).但是,您也可以在
<a>
或<input>
元素上使用这些类(尽管某些浏览器可能会应用稍微不同的渲染)。When using button classes on
<a>
elements that are used to trigger in-page functionality (like collapsing content), rather than linking to new pages or sections within the current page, these links should be given arole="button
" to appropriately convey their purpose to assistive technologies such as screen readers.当在
<a>
元素上使用用于触发页面内功能(如折叠内容)的按钮类时,而不是链接到当前页面中的新页面或部分,这些链接应该被赋予一个role="button
" 以适当地将他们的目的传达给屏幕阅读器等辅助技术。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.