gpt4 book ai didi

twitter-bootstrap - 使用 Bootstrap 隐藏超小型设备的边框

转载 作者:行者123 更新时间:2023-12-04 07:44:54 26 4
gpt4 key购买 nike

我有这个代码:

 <div class="container my-container">
<div class="row">
<div class="col-md-4"><div class="c-sin"><h1><span class="glyphicon glyphicon-heart"></span></h1>"TEXT"</div></div>
<div class="col-md-4"><div class="c-cen"><h1><span class="glyphicon glyphicon-user"></span></h1>"TEXT"</div></div>
<div class="col-md-4"><div class="c-des"><h1><span class="glyphicon glyphicon-inbox"></spa n></h1>"TEXT"</div></div>
</div>
</div>

PC上的边框问题如下所示:
http://i.imgur.com/MuU0sya.png

但在 xsmall 设备上是这样可见的:
http://i.imgur.com/JZ8pGlL.png

所以我决定将它们隐藏在 xsmall 设备上,但我不知道该怎么做。
这也是我用来创建边框的 CSS:
.c-sin {
border-right: 1px solid #DADADA;
padding-right: 10%;
}

.c-cen {
border-right: 1px solid #DADADA;
padding-right: 10%;
}

最佳答案

我使用 SASS 创建了一个新类:

@each $breakpoint in map-keys($grid-breakpoints) {
@include media-breakpoint-down($breakpoint) {
.border-#{$breakpoint}-left-none {
border-left:none !important;
}
.border-#{$breakpoint}-right-none {
border-right:none !important;
}
.border-#{$breakpoint}-top-none {
border-top:none !important;
}
.border-#{$breakpoint}-bottom-none {
border-bottom:none !important;
}
}
}

现在,您可以为您的 div 设置一个类似“border-xs-right”的类,对于超小屏幕,右边框将消失。 “border-sm-right”将使小屏幕和 xs 屏幕的右边框消失。

当然,您必须使用 SASS 来执行此操作。如果这不是您想做的事情,编译后的代码如下所示:
@media (max-width: 575.98px) {
.border-xs-left-none {
border-left: none !important; }
.border-xs-right-none {
border-right: none !important; }
.border-xs-top-none {
border-top: none !important; }
.border-xs-bottom-none {
border-bottom: none !important; } }

@media (max-width: 767.98px) {
.border-sm-left-none {
border-left: none !important; }
.border-sm-right-none {
border-right: none !important; }
.border-sm-top-none {
border-top: none !important; }
.border-sm-bottom-none {
border-bottom: none !important; } }

@media (max-width: 991.98px) {
.border-md-left-none {
border-left: none !important; }
.border-md-right-none {
border-right: none !important; }
.border-md-top-none {
border-top: none !important; }
.border-md-bottom-none {
border-bottom: none !important; } }

@media (max-width: 1199.98px) {
.border-lg-left-none {
border-left: none !important; }
.border-lg-right-none {
border-right: none !important; }
.border-lg-top-none {
border-top: none !important; }
.border-lg-bottom-none {
border-bottom: none !important; } }

.border-xl-left-none {
border-left: none !important; }

.border-xl-right-none {
border-right: none !important; }

.border-xl-top-none {
border-top: none !important; }

.border-xl-bottom-none {
border-bottom: none !important; }

关于twitter-bootstrap - 使用 Bootstrap 隐藏超小型设备的边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23583713/

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