怎样运用bootstrap制作form表单
发布时间:09/01 来源:未知 浏览:
关键词:
制作表单的办法
第一利用<form>标签设定表单,然后为表单的每个元素设定class =”form - group“(用“<div>”等标签设定你想要设定class =”form-group“的范畴)。最后通过在<input>标签中设定class =”form-control“来完成。
我们来看bootstrap创立表单的详细示例
代码如下
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>sample</title> <script src="bootstrap-4.2.1-dist/js/bootstrap.min.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="bootstrap-4.2.1-dist/css/bootstrap.min.css" /> </head> <body style="padding: 50px;"> <form> <div class="form-group"> <label for="email">电子邮箱</label> <input type="email" class="form-control" id="email" placeholder="电子邮箱"> </div> <div class="form-group"> <label for="pass">密码</label> <input type="password" class="form-control" id="pass" placeholder="密码"> </div> <div> <label for="file">文件上传:</label> <input type="file" id="file"> <p class="help-block">显示文件帮忙。</p> </div> <div class="check"> <label> <input type="checkbox">确定 </label> </div> <button type="submit" class="btu btn-default">发送</button> </form> </body> </html>
运转结果如下:
此外,还可以创立内联表单。我们只要在<form>标签中增加class =”form-inline“就可以了,在这里就不多说了,有乐趣的伴侣可以本人试一试。
总结,以上就是本篇文章的全部内容了,更多出色内容大家可以关注百分百源码网其他相关教程栏目!!!
以上就是怎样使用bootstrap制作form表单的具体内容,更多请关注百分百源码网其它相关文章!