【发布时间】:2026-01-31 06:15:01
【问题描述】:
我正在尝试使我的复选框居中对齐,当您添加新输入时,它们现在的显示方式如下: checkboxes not aligned well 。 这是我正在使用的代码(角度和引导程序):
<div class="container text-center">
<form ng-submit="todoAdd()">
<input type="text" ng-model="todoInput" size="50" placeholder="Add New">
<input type="submit" class="btn btn-success" value="Add New">
</form>
<br>
<div ng-repeat="x in todoList">
<input type="checkbox" ng-model="x.done"> <span ng-bind="x.todoText"></span>
</div>
<p><button ng-click="remove()">Remove marked</button></p>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('todoCtrl', function($scope) {
$scope.todoList = [{todoText:'Clean House', done:false}];
$scope.todoAdd = function() {
$scope.todoList.push({todoText:$scope.todoInput, done:false});
$scope.todoInput = "";
};
$scope.remove = function() {
var oldList = $scope.todoList;
$scope.todoList = [];
angular.forEach(oldList, function(x) {
if (!x.done) $scope.todoList.push(x);
});
};
});
</script>
我想知道是否有任何方法可以垂直对齐框(在页面中心),也许使用引导程序或任何其他建议会有所帮助?这是我的第一个问题,所以如果表述不正确,我提前道歉,并提前感谢您的回答!
【问题讨论】:
标签: angularjs twitter-bootstrap checkbox alignment