Bootstrap 边距 类 不适用于按钮
Bootstrap margin classes are not working on button
在我的代码中,将 m-0
添加到按钮的 类 并不能将按钮周围的边距减小为 0。但是当我将 .close {margin:0;}
添加到我的 SCSS 文件中时,它可以将边距减少到 0。有人告诉我不要这样做并使用缩短的 bootstrap 类,例如 m-0
和 p-0
。那么为什么将它们添加到按钮不起作用,我怎样才能用尽可能少的代码让它工作?
<h2 class="modal-title mx-auto mt-0">My text <br> Hi there </h2> <button type="button" class="close position-absolute m-0" data-dismiss="modal" aria-label="Close"> <i class="fas fa-times" style = "color: #2C757E;"></i> </button>
保证金工作正常(检查代码并检查)。
由于 HTML 中的 space(按 space 栏),您得到 space。
在我的代码中,将 m-0
添加到按钮的 类 并不能将按钮周围的边距减小为 0。但是当我将 .close {margin:0;}
添加到我的 SCSS 文件中时,它可以将边距减少到 0。有人告诉我不要这样做并使用缩短的 bootstrap 类,例如 m-0
和 p-0
。那么为什么将它们添加到按钮不起作用,我怎样才能用尽可能少的代码让它工作?
<h2 class="modal-title mx-auto mt-0">My text <br> Hi there </h2> <button type="button" class="close position-absolute m-0" data-dismiss="modal" aria-label="Close"> <i class="fas fa-times" style = "color: #2C757E;"></i> </button>
保证金工作正常(检查代码并检查)。
由于 HTML 中的 space(按 space 栏),您得到 space。