表单之 文本框 text

  <input type='text' value='' placeholder='输入您的用户名' class='input-mini' />

  ①几个类控制文本框长度

  input-mini:最小

    如图:

    

  input-small:次小

    如图:

    

  input-medium:中等

    如图:

    

  input-max:最长

    如图:

    

  spanN:N代表数字,最大12,N表示1个网格的宽度

    例如:span4表示对应的input框占用4个网格的宽度

  ②属性:placeholder="输入您的用户名",当用户开始输入时,提示文字自动消失。

  看图如下:

    

  代码如下: 

<label for='username'>用户名</label>
<input id='username' type='text' title='输入您的用户名' class='span-medium' placeholder="输入您的用户名" /><span class='help-block'>以字母开头,16位的字母、数字、下划线的组合</span>

.help-block | .help-inline

  提示文字【这里的提示文字是 “以字母开头,16位的字母、数字、下划线的组合”】另起一行显示/在输入框后显示

-----------------------------------------------------------------------------------------------------------------------------------------------------

 文本框的前缀和后缀

<div class='input-prepend input-append'><span class='add-on'>&yen;</span><input type='text' placeholder='输入金额' class='input-medium' /><span class='add-on'>.00</span></div>

说明:

  类

  .input-prepend:添加前缀

  .input-append: 添加后缀

  .add-on:修饰要添加的字符,一般使用它的元素为span标签

 这时候如图:

  

在给文本框添加前缀或者是后缀的时候需要添加以下css样式

<style>

  .input-prepend input, .input-append input {

    margin-top:10px;

  }

</style>

 这时候再看:

  

将按钮作为后缀

  <div class='input-append'><input type='text' placeholder='请输入搜索内容' class='input-medium' /><button class='btn'>搜索</button></div>

说明:

   button:按钮标签

   .btn:定义的一个按钮的样式

    .input-append:将按钮作为后缀

   如果文本框和按钮错位,同样需要设置文本框的margin-top:10px;

-----------------------------------------------------------------------------------------------------------------------------------------------------

表单之单选按钮 radio

简单用法:   

<label>性别</label>
<label class='radio'><input type='radio' name='sex' value='1' />男</label>
<label class='radio'><input type='radio' name='sex' value='2' />女</label>
<label class='radio'><input type='radio' name='sex' value='0' />保密</label>

如果要排在同一行上,那么设置label属性的 class='radio inline'

如图效果:

   

-----------------------------------------------------------------------------------------------------------------------------------------------------

表单之复选按钮 checkbox

<label>请选择下面的书籍类别</label>
<label class='checkbox inline'><input type='checkbox' name='type[]' value='1' />人物传记</label>
<label class='checkbox inline'><input type='checkbox' name='type[]' value='2' />财经</label>
<label class='checkbox inline'><input type='checkbox' name='type[]' value='3' />法律</label>

如果设置label元素的class='checkbox',那么每个checkbox各占一行。

以上代码块中如图效果:

    

-----------------------------------------------------------------------------------------------------------------------------------------------------

表单之下拉列表 select

<label for='go-where'>到哪去?</label>
<select id='go-where' multiple='multiple'>
<option value='1'>荷兰</option>
<option value='2'>新西兰</option>
<option value='3'>法国</option>
<option value='4'>德国</option>
</select>

注意这里的 multiple="multiple" 表示多选,去掉则是单选下拉列表

以上代码块中的效果如图:

-----------------------------------------------------------------------------------------------------------------------------------------------------

Bootstrap页面布局11 - BS表单的更多相关文章

  1. Bootstrap页面布局12 - BS表单元素的排版

    首先看看这行代码: <label for='account'>帐 号</label> <input id='account' name='account' type='t ...

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

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

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

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

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

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

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

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

  6. Bootstrap页面布局18 - BS导航路径以及分页器

    导航路径:又叫“面包屑”,功能是让用户知道所处的位置. <!--面包屑--> <ul class='breadcrumb'> <li><a href='#'& ...

  7. Bootstrap页面布局17 - BS选项卡

    代码结构: <div class='container-fluid'> <h2 class='page-header'>Bootstrap 选项卡</h2> < ...

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

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

  9. Bootstrap页面布局24 - BS旋转木马功能

    代码: <div class='container-fluid'> <h3 class='page-header'>Bootstrap 旋转木马</h3> < ...

随机推荐

  1. HDU 1796 How many integers can you find 容斥入门

    How many integers can you find Problem Description   Now you get a number N, and a M-integers set, y ...

  2. 网站构建学习笔记(0)——基本概念了解及资源学习(copy自w3school)

    一.学习方面 1.WWW - 万维网 什么是 WWW? WWW 指万维网(World Wide Web) 万维网常被称为Web Web 是由遍布全球的计算机所组成的网络 所有 Web 中的计算机都可以 ...

  3. Seismic Unix的一些历史

    本文是我从官网上拷贝过来的,上国外网越来越慢了……(离题了). At the Society of Exploration Geophysicists (SEG) Annual Meeting in ...

  4. JavaScript中的3种弹出式消息提醒(警告窗口,确认窗口,信息输入窗口)的命令是什么?

    1.Alert()显示带有一段文字和一个确认按钮的警告窗口; 2.Confirm()显示带有一段文字以及确认和取消按钮的确认窗口; 3.Prompt()显示可提示用户输入的对话框.

  5. 介绍开发Android手持终端PDA盘点APP软件

    介绍开发Android手持终端PDA盘点APP软件 软件需要自动识别我导入的TXT格式或者excl格式的盘点表,然后自动生成一个复盘数据,做AB比对,界面上需要显示的有总数量,单品数量,条码,编码,商 ...

  6. maven 编译报错 “找不到符号”

    报错如下: E:\workspace\iccardcore\mis\src\main\java\com\hxsmart\sicard\core\webapp\action\process\DayEnd ...

  7. 字符串截取函数substr和substring的不同及其相关说明

    1.substr 方法 功能:用于返回一个从指定位置开始的指定长度的子字符串,从“母字符串”的“指定位置”开始提取“指定长度”的“子字符串”. 语法:stringObject.substr(start ...

  8. css构造文本

    1. 1. 文本缩进text-indent:值:值为数字,最常用的数值单位是px(像素),也可以直接是百分比!text-indent:100px;text-indent:10%;2. 文本对齐text ...

  9. The Accomodation of Students

    The Accomodation of Students Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ( ...

  10. POJ 2217 (后缀数组+最长公共子串)

    题目链接: http://poj.org/problem?id=2217 题目大意: 求两个串的最长公共子串,注意子串是连续的,而子序列可以不连续. 解题思路: 后缀数组解法是这类问题的模板解法. 对 ...