Bootstrap 4 Safari on Mac Grid issue

ぃ、小莉子 提交于 2019-12-04 16:17:22

问题


There is an issue with Bootstrap 4 and Safari brower on Mac. When using cols inside a row it breaks it, and doesn't work like on firefox or chrome. I'm using a simple code like this:

<div class="row align-items-center">
    <div class="col-sm-12 col-md-3 hidden-xs align_left"><h3>TEXT</h3></div>
    <div class="col-sm-4 col-md-3">TEXT</div>
    <div class="col-sm-4 col-md-3">TEXT</div>
    <div class="col-sm-4 col-md-3">TEXT</div>
</div>

I'm trying different 'fix codes' from another questions but they doesn't solve the problem. Any clue?

Thanks in advance


回答1:


Finally solved the problem with this simple CSS:

.row:before, .row:after {display: none !important;}

It seems there is some code hidden in :before and :after elements inside the rows. This causes some kind of issues in safari browsers.

Hope it helps.




回答2:


.row:before, .row:after {width:0px; height:0px;}

There is a reason for display:table before and after row. By using display:none, the row will not preserve its height depending on the elements inside it, and row height is now 0px because the columns inside is floating..



来源:https://stackoverflow.com/questions/49403391/bootstrap-4-safari-on-mac-grid-issue

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