简体   繁体   English

如何使用 css 将 bootstrap class col-md-10 更改为 div 的 col-md-12

[英]how to change bootstrap class col-md-10 into col-md-12 of div using css

I used thumbnail section and view section in my project.我在我的项目中使用了缩略图部分和视图部分。 So I divided parent div into two div, first is col-md-3 (that is thumbnail div) and second is col-md-9 (that is view section).所以我把父div分成了两个div,第一个是col-md-3 (即缩略图div),第二个是col-md-9 (即视图部分)。 Now I want to hide first div and change second div into col-md-12 for small device like mobile or ipad.现在我想隐藏第一个 div 并将第二个 div 更改为col-md-12 ,用于移动设备或 ipad 等小型设备。

Is there any way to make it with media query?有什么办法可以用媒体查询来实现吗?

Bootstrap col system for grid has this built in. When you specify col-md-3 you are saying "at medium screen give this col 3 blocks".用于网格的 Bootstrap col 系统内置了这个。当您指定 col-md-3 时,您是在说“在中等屏幕上给这个 col 3 个块”。 You can also do, side by side col-sm-12 to give it the entire row when on large screen and col-sm-0 to hide it when on smaller screens.您也可以并排使用 col-sm-12 在大屏幕上显示整行,在小屏幕上使用 col-sm-0 隐藏它。 Look here for a better explanation about bootstrap grid system: https://getbootstrap.com/docs/4.1/layout/grid/在这里查看有关引导网格系统的更好解释: https://getbootstrap.com/docs/4.1/layout/grid/

<div class="row">
  <div class="col-md-3 d-none d-sm-none d-md-block">THUMBNAIL</div>
  <div class="col-md-9">Some data</div>
</div>

This will solve your issue.这将解决您的问题。 For extra small and small screen thumbnail will not appear.对于超小和小屏幕缩略图将不会出现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 col-md-12的Bootstrap问题 - Bootstrap issue with col-md-12 class =&#39;col-md-12&#39;在Firefox中无法正常工作,但在chrome中可以正常工作? - class='col-md-12' is not working correctly in firefox but working in chrome? 我正在尝试从 bootstrap 的脚本文件中删除 class="row" 和 class="col-md-12" 之类的类。我可以用 css 覆盖和删除它吗? - I'm trying to remove classes like class="row" and class="col-md-12" coming from a script file from bootstrap.Can I override and remove it with css? 在引导程序中,如果未指定col-md和col-lg,是否将class =“ col-sm-4”视为class =“ col-sm-4 col-md-4 col-lg-4”? - In bootstrap, Is class=“col-sm-4” will be considered as class=“col-sm-4 col-md-4 col-lg-4”, if col-md and col-lg are not specied? 将div圆放置在四个col-md-6引导程序div的中心 - Positioning a div circle on the center of four col-md-6 bootstrap div Bootstrap col-md 问题 - Bootstrap col-md issue jQuery的点击不闩锁到引导col-md div - jquery click not latching onto bootstrap col-md div 有没有一种方法可以根据Angular中的元素数量来更改col-md类? - Is there a way to change the col-md class dependent on the number of elements in Angular? Bootstrap3会忽略IE8中的col-lg col-md和col-sm - Bootstrap3 ignores col-lg col-md and col-sm in IE8 使用纯javascript从特定div中删除所有.col-md类 - remove all .col-md class from specific div with pure javascript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM