[英]Bootstrap button alignment small screen width
okay I'm styling some buttons for a mini survey site I am building and I am happy with how it looks on a desktop, but when i resize the browser window to a size that resembles a phone I cant get the buttons to just align under eachother. 好吧,我正在为正在构建的小型调查站点设计一些按钮的样式,并且对它在桌面上的外观感到满意,但是当我将浏览器窗口的大小调整为类似于手机的大小时,我无法使按钮在下面对齐彼此。 the desktop sized version has 2 rows, one with 3 buttons and one with 2 buttons.
桌面版的版本有2行,一行包含3个按钮,另一行包含2个按钮。
full size desktop it looks ok : 全尺寸的桌面看起来还可以:
reduced width: 减少宽度:
my button code : 我的按钮代码:
<div class="panel-body" style="padding-bottom:0px;">
<div class="row">
<div class="btn-group btn-group-justified mg0 pd0"role="group" aria-label="...">
<div class="col-xs-6 col-sm-4 mg0 pd0">
<button type="button" class="btn btn-default btn-lg btn-block" id="btnChoice1" value="<?php echo $aId[0];?>"><?php echo $aTitle[0];?></button>
</div><div class="col-xs-6 col-sm-4 mg0 pd0">
<button type="button" class="btn btn-default btn-lg btn-block" id="btnChoice2" value="<?php echo $aId[1];?>"><?php echo $aTitle[1];?></button>
</div><div class="col-xs-6 col-sm-4 mg0 pd0">
<button type="button" class="btn btn-default btn-lg btn-block" id="btnChoice3" value="<?php echo $aId[2];?>"><?php echo $aTitle[2];?></button>
</div>
</div>
</div><div class="row">
<div class="btn-group btn-group-justified mg0"role="group" aria-label="...">
<div class="col-xs-6 mg0 pd0">
<button type="button" class="btn btn-default btn-lg btn-block" id="btnChoice4" value="<?php echo $aId[3];?>"><?php echo $aTitle[3];?></button>
</div><div class="col-xs-6 mg0 pd0">
<button type="button" class="btn btn-default btn-lg btn-block" id="btnChoice5" value="<?php echo $aId[4];?>"><?php echo $aTitle[4];?></button>
</div>
</div>
</div>
</div>
I am trying to get the buttons to align themselves one per one under eachother instead of 2 buttons then one then 2 again and text getting outside the buttons in the second picture... 我正在尝试使按钮彼此对齐,而不是2个按钮,然后再是2个,文本在第二张图片的按钮之外...
any help? 有什么帮助吗?
thanks 谢谢
Try adding the class class="col-xs-12"
instead of class="col-xs-6'
to the button divs
. 尝试将class
class="col-xs-12"
而不是class="col-xs-6'
到按钮divs
。
This means the buttons will occupy all 12 grid columns at the xs resolution, rather than 2 buttons at col-6 这意味着按钮将以xs分辨率占据所有12个网格列,而不是col-6处的2个按钮
thanks i got it now the lower two buttons needed a declaration for md and now its fixed, i understand how it works now the grid xs md lg system ... 谢谢,我现在知道了,下面的两个按钮需要为md声明,并且现在已修复,我知道它现在是如何工作的了,网格xs md lg系统...
<div class="btn-group btn-group-justified mg0 "role="group" aria-label="...">
<div class="mg0 pd0 col-xs-12 col-md-6">
<button type="button" class="btn btn-default btn-lg btn-block" id="btnChoice4" value="<?php echo $aId[3];?>"><?php echo $aTitle[3];?></button>
</div><div class="mg0 pd0 col-xs-12 col-md-6">
<button type="button" class="btn btn-default btn-lg btn-block" id="btnChoice5" value="<?php echo $aId[4];?>"><?php echo $aTitle[4];?></button>
</div>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.