在移动设备上,我希望我的孩子div垂直堆叠。
虽然.content_hover位于主div内,但在移动设备上,我希望它显示在它的下方。
这是如何实现的?
这是我正在使用的标记
<div class="columns bg_orange small-12 large-4 tile mobile-small-tile">
<h2 class="bottom_title no_bg hight_text">Current Patient Information</h2>
<div class="content_hover">
<p><br>Join us to discuss the IVF process and meet other people on the fertility journey.</p>
<a class="more_infos_hover" href="#">Register now ></a>
</div>
</div>
我是否需要将content_hover定位为绝对?并推下它?
最佳答案
默认情况下,div是一个“块”元素,因此“兄弟姐妹”将垂直堆叠。
因此,我认为您在问如何获取“子” div以便使其堆叠在“父”之下。
通过更改标记以反映您要生成的结构(这是“同级”而不是“子级”)最容易实现。如果不能,则可能需要使用相对定位,这将使布局取决于内容:-(
关于html - div不要垂直堆叠,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27369829/