首先看看这行代码:

<label for='account'>帐 号</label>
<input id='account' name='account' type='text' value='' placeholder='请输入手机号/邮箱' />
<p class='help-block'>请输入您注册时的手机/邮箱</p> <label for='password'>密 码</label>
<input id='password' name='account' type='password' value='' placeholder='请输入账号密码' />
<p class='help-block'>请输入帐号密码</p> <button type='button' class='btn btn-primary'>登 录</button>

如图效果:

为了使之在同一行上,我们需要改进一下代码

<form class='form-horizontal'>
<fieldset>
<legend>用户登录</legend>
<div class='control-group'>
<label class='control-label' for='account'>帐 号</label>
<div class='controls'>
<input id='account' name='account' type='text' value='' placeholder='请输入手机号/邮箱' />
<p class='help-block'>请输入您注册时的手机/邮箱</p>
</div>
</div> <div class='control-group'>
<label class='control-label' for='password'>密 码</label>
<div class='controls'>
<input id='password' name='account' type='password' value='' placeholder='请输入账号密码' />
<p class='help-block'>请输入帐号密码</p>
</div>
</div>
</fieldset>
<div class='form-actions'>
 <button type='submit' class='btn btn-primary'>登 录</button>
</div>
</form>

说明:

  legend标签:定义表单描述,且下方会有灰色的线

  .form-actions: 灰色背景和适当的边距

  .controls:包围住表单元素

  .control-label:如果要使“密码”文字和文本框在同一线上,需要给“密码”外围的lable添加.control-label类,同时需要给文本框和提示文字外围包围一个类为.cnotrols的div

效果如图:

Bootstrap页面布局12 - BS表单元素的排版的更多相关文章

  1. Bootstrap页面布局11 - BS表单

    表单之 文本框 text <input type='text' value='' placeholder='输入您的用户名' class='input-mini' /> ①几个类控制文本框 ...

  2. 2017年12月17日 ASP.NET 12个表单元素&&简单控件/复合控件

    12个表单元素可以分为三大类 第一类:文本类 <input type = "text" /> //普通文本框 <input type = "passwo ...

  3. HTML——超文本标记语言(表单及12个表单元素)

    表单 格式: <form action=" " method="get/post"  placehoder=" "></f ...

  4. Bootstrap页面布局3 - BS布局以及流动布局

    1. <h1 class='page-header'>布局<small> 使用bootstrap网格系统布局网页</small></h1> 得到如图所示 ...

  5. Bootstrap页面布局16 - BS导航菜单和其响应式布局以及导航中的下拉菜单

    代码: <div class='container-fluid'> <h2 class='page-header'>导航</h2> <!-- .navrbar ...

  6. Bootstrap页面布局9 - BS列表

    列表: 无序列表(列表中项目内容没有固定的顺序), 有序列表(通常使用在一组有前后顺序的内容上), 描述列表(定义解释一组词汇) 无序列表: <ul> <li>Ueditor编 ...

  7. Bootstrap页面布局6 - BS把已有的固定宽度布局转换成响应式布局

    首先引入文件bootstrap-responsive.css <link href="bootstrap/css/bootstrap-responsive.css" rel= ...

  8. Bootstrap页面布局23 - BS折叠内容

    <div class='container-fluid'> <h3 class='page-header'>Bootstrap 折叠内容</h3> <!--如 ...

  9. Bootstrap页面布局20 - BS缩略图

    <div class='container-fluid'> <h2 class='page-header'>Bootstrap 缩略图</h2> <ul cl ...

随机推荐

  1. MVC @helper (转载)

    转载地址:http://gaoling386.blog.163.com/blog/static/5404602420130595842894/ ASP.NET MVC 3支持一项名为“Razor”的新 ...

  2. jquery easy ui 1.3.4 表单(7)

    7.1.ValidateBox(表单验证) 使用validType属性指定验证方法 1.标签方式创建 <input type="text" class="easyu ...

  3. ytu 1304:串的简单处理(水题)

    串的简单处理 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 39  Solved: 11[Submit][Status][Web Board] Desc ...

  4. oracle DBA坚持写博客的7大理由

    对于Oracle DBA来说,甚至IT技术人员来说.坚持写博客是个好习惯.以下是我建议大家写博客的七个理由. 帮助整理思路 最近我做出了一个决定,那就是: 我要坚持天天写博客,记录每天所学的重要东西. ...

  5. 神经网络:多层网络与C++实现

    相关源码可参考最新的实现:https://github.com/ronnyyoung/EasyML ,中的neural_network模块,后持续更新,包括加入CNN的结构. 一.引言 在前一篇关于神 ...

  6. C++的那些事:面向对象

    1 OOP概述 面向对象基于三个基本概念:数据抽象.继承和动态绑定.通过使用数据抽象,我们可以将类的接口与实现分离:使用继承,可以定义相似的类型并对其相似关系建模:使用动态绑定,可以在一定程度上忽略相 ...

  7. poj 2378(树形dp)

    题目链接:http://poj.org/problem?id=2378 思路:num[u]表示以u为根的子树的顶点个数(包括),如果去掉u之后u的每棵子树都小于等于n/2,则选择u. #include ...

  8. Web测试Selenium:如何选取元素

    Web测试工具Selenium:如何选取元素 2009-02-17 23:23 by 敏捷的水, 5372 阅读, 22 评论, 收藏, 编辑 selenium是一个非常棒的Web测试工具,他对Aja ...

  9. MVC 路由模块分析(一)

    概述 主要分为四个部分进行分析. First ——Usage: then ——Extension: and then ——Design: last ——Test. 1. Usage 1.1 Displ ...

  10. 在python包管理中使用easy_install软件的步骤

    本文主要介绍的是让python包管理变得更加容易的实际应用方法,就是运用easy_install这一软件,下面是文章的具体介绍. easy_install让python包管理变得 如果你想对Pytho ...