【发布时间】:2015-11-16 14:10:29
【问题描述】:
我正在尝试为高尔夫计分 Web 应用程序创建一个更简单的 UI,以便人们输入数据。原则是为每个乐谱按下大按钮,而不是输入它们。
我创建了一个额外的 CSS 文件来使按钮大于默认按钮...
.btn-sq-lg {
width: 150px !important;
height: 150px !important;
}
.btn-sq {
width: 100px !important;
height: 100px !important;
font-size: 10px;
}
.btn-sq-sm {
width: 50px !important;
height: 50px !important;
font-size: 10px;
}
.btn-sq-xs {
width: 25px !important;
height: 25px !important;
padding:2px;
}
目前我有以下内容,可以在桌面设备上正确显示(忽略“xs”网格单元,这是我在玩的。“lg”网格单元格格式如我所愿......)
<div class="row">
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-2 col-lg-offset-1">
<button type="button" class="btn btn-primary btn-sq">Blob</button>
</div>
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-2">
<button type="button" class="btn btn-primary btn-sq">2</button>
</div>
</div>
<div class="row">
<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2">
<button type="button" class="btn btn-primary btn-sq">3</button>
</div>
<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2">
<button type="button" class="btn btn-primary btn-sq">4</button>
</div>
<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2">
<button type="button" class="btn btn-primary btn-sq">5</button>
</div>
</div>
<div class="row">
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-2 col-lg-offset-1">
<button type="button" class="btn btn-primary btn-sq">6</button>
</div>
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-2">
<button type="button" class="btn btn-primary btn-sq">7</button>
</div>
</div>
如何/什么相当于使相同的格式出现在移动设备上?
我可以根据需要使用备用(自定义)按钮大小,只是为要使用的语法寻找一个好的指导......
【问题讨论】:
-
您的标题没有抓住问题的重点。我会选择类似:“在标准断点处将 Bootstrap 按钮大小调整为自定义大小”我会删除对问题不重要的任何 html 代码和类,我会检查问题正文并尝试重写它,以便它说明了您当前的问题,如果有任何障碍,然后清楚地提出一个问题,让我们知道您正在尝试完成什么以及您为达到目标而采取了哪些步骤。
-
为什么
!important这通常是为极少数情况保留的,但类似于实用程序类,绝对不是 Bootstrap 覆盖。阅读:css-tricks.com/when-using-important-is-the-right-choice
标签: css twitter-bootstrap button grid