Twitter bootstrap 如何在输入组div中左对齐复选框?
我能够左对齐表单组中的复选框。但是我想在复选框的左边添加一些文本。因此,我将复选框和前置文本放在一个输入组中。一旦复选框位于该输入组div内,复选框就不会左对齐 如何在输入组div中左对齐复选框Twitter bootstrap 如何在输入组div中左对齐复选框?,twitter-bootstrap,Twitter Bootstrap,我能够左对齐表单组中的复选框。但是我想在复选框的左边添加一些文本。因此,我将复选框和前置文本放在一个输入组中。一旦复选框位于该输入组div内,复选框就不会左对齐 如何在输入组div中左对齐复选框 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>bootstrap alignment test</title>
<link rel="stylesheet"
href="//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB"
crossorigin="anonymous">
<script src="//code.jquery.com/jquery-1.12.4.js"></script>
<script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<style>
.move-left {
box-shadow: none;
width: auto;
}
</style>
</head>
<body>
<div id="app">
<div class="container">
<form>
<div class="form-group">
<label class="control-label col-sm-2" for="field3">Field 3:</label>
<div class="col-sm-8">
<input class="form-control move-left" type="checkbox" id="field3">
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">Discontinued</span>
</div>
<input type="checkbox" class="form-control move-left" >
</div>
</div>
</form>
</div>
</div>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"
integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T"
crossorigin="anonymous"></script>
</body>
</html>
自举校准测试
.向左走{
盒影:无;
宽度:自动;
}
字段3:
中止
如果希望附加文本保持在复选框的左侧,请将复选框放在附加文本下方,与输入组append位于同一div下。这是我能想到的解决你问题的最快方法
自举校准测试
.向左走{
盒影:无;
宽度:自动;
}
字段3:
中止