gpt4 book ai didi

html - Bootstrap 水平形式不起作用

转载 作者:搜寻专家 更新时间:2023-10-31 08:51:05 24 4
gpt4 key购买 nike

我正在尝试为我的 laravel 应用程序构建一个带有 Bootstrap 的简单水平表单。这是我正在使用的代码。但它是这样显示的:

form is displayed on the left halve of the page

表单显示在页面的左半部分。有任何想法吗?表单最好位于页面的中央。

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<div class="container">
<form class="form-horizontal">
<fieldset>

<!-- Form Name -->
<legend>Register</legend>

<!-- Text input-->
<div class="form-group">
<label class="col-sm-6 control-label" for="name">Name</label>
<div class="col-sm-6">
<input id="name" name="name" placeholder="Name" class="form-control input-md" required="" type="text">
</div>
</div>

<!-- Text input-->
<div class="form-group">
<label class="col-sm-6 control-label" for="email">Email</label>
<div class="col-sm-6">
<input id="email" name="email" placeholder="Email" class="form-control input-md" required="" type="email">
</div>
</div>

<!-- Password input-->
<div class="form-group">
<label class="col-sm-6 control-label" for="password">Password</label>
<div class="col-sm-6">
<input id="password" name="password" placeholder="Password" class="form-control input-md" required="" type="password">
</div>
</div>

<!-- Password input-->
<div class="form-group">
<label class="col-sm-6 control-label" for="password_confirmation">Confirm Password</label>
<div class="col-sm-6">
<input id="password_confirmation" name="password_confirmation" placeholder="Re-enter Password" class="form-control input-md" required="" type="password">
</div>
</div>

<!-- Button -->
<div class="form-group">
<label class="col-sm-6 control-label" for="submit"></label>
<div class="col-sm-6">
<button id="submit" name="submit" class="btn btn-primary">Register</button>
</div>
</div>

</fieldset>
</form>
</div>

最佳答案

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<div class="container">
<form class="form-horizontal">
<fieldset>

<!-- Form Name -->
<legend>Register</legend>

<!-- Text input-->
<div class="form-group">
<label class="col-sm-3 control-label" for="name">Name</label>
<div class="col-sm-6">
<input id="name" name="name" placeholder="Name" class="form-control input-md" required="" type="text">
</div>
</div>

<!-- Text input-->
<div class="form-group">
<label class="col-sm-3 control-label" for="email">Email</label>
<div class="col-sm-6">
<input id="email" name="email" placeholder="Email" class="form-control input-md" required="" type="email">
</div>
</div>

<!-- Password input-->
<div class="form-group">
<label class="col-sm-3 control-label" for="password">Password</label>
<div class="col-sm-6">
<input id="password" name="password" placeholder="Password" class="form-control input-md" required="" type="password">
</div>
</div>

<!-- Password input-->
<div class="form-group">
<label class="col-sm-3 control-label" for="password_confirmation">Confirm Password</label>
<div class="col-sm-6">
<input id="password_confirmation" name="password_confirmation" placeholder="Re-enter Password" class="form-control input-md" required="" type="password">
</div>
</div>

<!-- Button -->
<div class="form-group">
<label class="col-sm-3 control-label" for="submit"></label>
<div class="col-sm-6">
<button id="submit" name="submit" class="btn btn-primary">Register</button>
</div>
</div>

</fieldset>
</form>
</div>

col-sm-6 控制标签 =>col-sm-3 控制标签

关于html - Bootstrap 水平形式不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46375388/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com