3 回答
TA贡献1828条经验 获得超6个赞
Bootstrap 4更新
hidden-*
visible-*
d-*
显示类
xs
-xs
hidden-xs-down (hidden-xs)
=d-none d-sm-block
hidden-sm-down (hidden-sm hidden-xs)
=d-none d-md-block
hidden-md-down (hidden-md hidden-sm hidden-xs)
=d-none d-lg-block
hidden-lg-down
=d-none d-xl-block
hidden-xl-down
(n/a 3.x)= d-none
(与 hidden
)
hidden-xs-up
=d-none
(与 hidden
)hidden-sm-up
=d-sm-none
hidden-md-up
=d-md-none
hidden-lg-up
=d-lg-none
hidden-xl-up
(n/a 3.x)= d-xl-none
hidden-xs
(仅)= d-none d-sm-block
(与 hidden-xs-down
)hidden-sm
(仅)= d-block d-sm-none d-md-block
hidden-md
(仅)= d-block d-md-none d-lg-block
hidden-lg
(仅)= d-block d-lg-none d-xl-block
hidden-xl
(n/a 3.x)= d-block d-xl-none
visible-xs
(仅)= d-block d-sm-none
visible-sm
(仅)= d-none d-sm-block d-md-none
visible-md
(仅)= d-none d-md-block d-lg-none
visible-lg
(仅)= d-none d-lg-block d-xl-none
visible-xl
(n/a 3.x)= d-none d-xl-block
还有,d-*-block
d-*-inline
, d-*-flex
, d-*-table-cell
, d-*-table
TA贡献1864条经验 获得超6个赞
.visible-sm-block
.hidden-xs-down
.hidden-md-up
.hidden-sm-down
.hidden-lg-up
hidden-sm-up
.visible-sm-block { display: none !important;}@media (min-width: 768px) and (max-width: 991px) { .visible-sm-block { display: block !important; }}
.hidden-sm-down
.hidden-lg-up
@media (max-width: 768px) { .hidden-xs-down { display: none !important; }}@media (min-width: 991px) { .hidden-lg-up { display: none !important; }}
.visible-sm-block
.visible-lg-block
这些类并不试图适应不太常见的情况,在这种情况下,元素的可见性不能表示为一个连续的视口断点大小范围;相反,您需要在这种情况下使用自定义CSS。
.visible-sm-and-lg { display: none !important;}@media (min-width: 768px) and (max-width: 991px) { .visible-sm-and-lg { display: block !important; }}@media (min-width: 1200px) { .visible-sm-and-lg { display: block !important; }}
添加回答
举报