我有应该在两端都偏移的行。这是示例:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<div class="container">
<div class="row">
<div class="col-xs-2 offset-xs-2">
<input type="submit" name="btn" value="OK" class="btn btn-primary">
</div>
<div class="col-xs-2">
<input type="button" name="cancel" value="Cancel" class="btn btn-primary">
</div>
<div class="col-xs-2">
<input type="button" value="Open" class="btn btn-primary">
</div>
<div class="col-xs-2 ">
<input type="button" name="page" class="btn btn-primary " value="Page">
</div>
</div>
</div>
是否可以将偏移量应用于此网格系统,以将按钮移至中心?这应该在所有屏幕尺寸上都以相同的方式起作用。
答案 0 :(得分:0)
您正在使用带有3.3.7 CSS链接的Bootstrap 4语法。
引导程序4:offset-xs-2
引导程序3:col-xs-offset-2
我将offset-xs-2
更改为col-xs-offset-2
。
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<div class="container">
<div class="row">
<div class="col-xs-2 col-xs-offset-2">
<input type="submit" name="btn" value="OK" class="btn btn-primary">
</div>
<div class="col-xs-2">
<input type="button" name="cancel" value="Cancel" class="btn btn-primary">
</div>
<div class="col-xs-2">
<input type="button" value="Open" class="btn btn-primary">
</div>
<div class="col-xs-2 ">
<input type="button" name="page" class="btn btn-primary " value="Page">
</div>
</div>
</div>