Html 根据引导中的设备隐藏和移动div

Html 根据引导中的设备隐藏和移动div,html,css,twitter-bootstrap-3,Html,Css,Twitter Bootstrap 3,我正在使用Bootstrap创建一个布局,用于显示桌面、平板电脑和移动设备。我试图实现的目标如下所示: 为此,我创建了三个div: <div class="row"> <div class="col-md-3">Text</div> <div class="col-md-3">Text</div> <div class="col-md-3">Text</div> </div> 正文

我正在使用Bootstrap创建一个布局,用于显示桌面、平板电脑和移动设备。我试图实现的目标如下所示:

为此,我创建了三个div:

<div class="row">
  <div class="col-md-3">Text</div>
  <div class="col-md-3">Text</div>
  <div class="col-md-3">Text</div>
</div>

正文
正文
正文
中间的div将在tablet视图中隐藏,然后在mobile视图中最后一个div将低于第一个div

使用我目前拥有的功能,所有三个div都可以正确地显示在桌面上,但在平板电脑和移动设备中,这三个div都可以垂直折叠


是否有一种简单的方法可以通过引导实现这一点,或者我必须编写自己的CSS媒体查询?

要隐藏中间的div,请使用引导中描述的实用程序类:

.row {width:100%;position:relative;}
.col-md-3{width:3.33333%;float:left;padding:10px;height:100px;}
引导程序3

使用
visible lg
类隐藏平板电脑和手机上的div

我建议根据宽度()使用col sm和col xs折叠或不折叠div:


正文
正文
正文
看到这个了吗


引导程序2.3


使用
可见桌面
类隐藏平板电脑和手机上的div。

要隐藏中间的div,请使用引导中描述的实用程序类:

引导程序3

使用
visible lg
类隐藏平板电脑和手机上的div

我建议根据宽度()使用col sm和col xs折叠或不折叠div:


正文
正文
正文
看到这个了吗


引导程序2.3


使用
visible desktop
类隐藏平板电脑和手机上的div。

除了@Getz answer之外,这里还有一些详细介绍您的问题的参考资料

要定位设备,只需写入
min device width
。例如:

对于iPhone

@media only screen and (min-device-width: 480px){
.middle_div { display: none;}
/* other responsive styles*/
}
药片

@media only screen and (min-device-width: 768px){
.middle_div { display: none;}
}
针对所有设备的最佳训练解决方案

/* Smartphones (portrait and landscape) ----------- */
@media only screen 
and (min-device-width : 320px) 
and (max-device-width : 480px) {
/* Styles */
}

/* Smartphones (landscape) ----------- */
@media only screen 
and (min-width : 321px) {
/* Styles */
}

/* Smartphones (portrait) ----------- */
@media only screen 
and (max-width : 320px) {
/* Styles */
}

/* iPads (portrait and landscape) ----------- */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) {
/* Styles */
}

/* iPads (landscape) ----------- */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : landscape) {
/* Styles */
}

/* iPads (portrait) ----------- */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : portrait) {
/* Styles */
}

/* Desktops and laptops ----------- */
@media only screen 
and (min-width : 1224px) {
/* Styles */
}

/* Large screens ----------- */
@media only screen 
and (min-width : 1824px) {
/* Styles */
}

/* iPhone 4 ----------- */
@media
only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {
/* Styles */
}

除了@Getz answer,这里还有一些详细介绍您的问题的参考资料

要定位设备,只需写入
min device width
。例如:

对于iPhone

@media only screen and (min-device-width: 480px){
.middle_div { display: none;}
/* other responsive styles*/
}
药片

@media only screen and (min-device-width: 768px){
.middle_div { display: none;}
}
针对所有设备的最佳训练解决方案

/* Smartphones (portrait and landscape) ----------- */
@media only screen 
and (min-device-width : 320px) 
and (max-device-width : 480px) {
/* Styles */
}

/* Smartphones (landscape) ----------- */
@media only screen 
and (min-width : 321px) {
/* Styles */
}

/* Smartphones (portrait) ----------- */
@media only screen 
and (max-width : 320px) {
/* Styles */
}

/* iPads (portrait and landscape) ----------- */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) {
/* Styles */
}

/* iPads (landscape) ----------- */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : landscape) {
/* Styles */
}

/* iPads (portrait) ----------- */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : portrait) {
/* Styles */
}

/* Desktops and laptops ----------- */
@media only screen 
and (min-width : 1224px) {
/* Styles */
}

/* Large screens ----------- */
@media only screen 
and (min-width : 1824px) {
/* Styles */
}

/* iPhone 4 ----------- */
@media
only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {
/* Styles */
}

正文
正文
正文
正文
正文
正文
正文

正文
正文
正文
正文
正文
正文
正文

这可能是引导程序2.3的一个解决方案,但是在V3中使用新的网格系统,它可以做得更简单。@ GETZ是的,我看到了你的答案…不是BootSRAP家伙…我使用Buffel...),它可以是引导2.3的一个解决方案,但是在V3中有新的网格系统,它可以做得更简单。“GETZ是的,我看到了你的答案…不是一个BooSrad家伙…我使用基金会…..)谢谢你的努力投入到这个答案,谢谢。谢谢你为这个答案投入的努力,很感激。