Bootstrap 3 Options Menu Disappears

不打扰是莪最后的温柔 提交于 2019-12-25 04:26:34

问题


I have a table of 4 columns using the Bootstrap 3 grid system. Instead of using the col-xs-*, which works great on mobile, I used the col-md-*. The reason was simple -- on mobile, I didn't want the icons to shrink down very small and wanted them larger and visible on mobile. When I switched from col-xs-* to col-md-* for these columns, the mobile would automatically stack the icons in the grid and keep them large -- which is exactly what I want.

Okay, all is well except that somehow this makes the document width get messed up, and the Options Menu (the three-bar popdown menu for mobiles/tablets) disappears because it's aligned to the document width, not the viewport width.

Does anyone know a good CSS fix for that common problem?


回答1:


I found the cause of my problem. It wasn't because of the responsive columns. It was because inside my responsive columns, I was doing absolute positioning in a relative container so that my P tag would align to the bottom of a box, but then my text wasn't centered, so I applied this:

.box P
{
position:absolute;
bottom:5px;
left:-50%;
right:-50%;
}

When I did that, it caused the options menu to jump off screen. The fix was that I switched the left and right like so:

.box P
{
position: absolute;
bottom: 5px;
left:0;
right:0;
}

This centered that P tag text inside the responsive columns, but yet still allowed me to use absolute positioning inside a box of the grid that was set to position:relative. This caused the document width to act normal again and thus the Options Menu reappeared.



来源:https://stackoverflow.com/questions/39359739/bootstrap-3-options-menu-disappears

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!