Follow us on Twitter and Facebook

/// Tables and Forms

/// Table markup

Tag Description
<table> Wrapping element for displaying data in a tabular format
<thead> Container element for table header rows (<tr>) to label table columns
<tbody> Container element for table rows (<tr>) in the body of the table
<tr> Container element for a set of table cells (<td> or <th>) that appears on a single row
<td> Default table cell
<th> Special table cell for column (or row, depending on scope and placement) labels
Must be used within a <thead>
<caption> Description or summary of what the table holds, especially useful for screen readers

/// Table options

Name Class Description
Default None No styles, just columns and rows
Basic .table Only horizontal lines between rows
Bordered .table-bordered Rounds corners and adds outer border
Zebra-stripe .table-striped Adds light gray background color to odd rows (1, 3, 5, etc)
Condensed .table-condensed Cuts vertical padding in half, from 8px to 4px, within all td and th elements

/// Example tables

1. Default table styles

Tables are automatically styled with only a few borders to ensure readability and maintain structure. With 2.0, the .table class is required.

<table class="table">
# First Name Last Name Username
1 Mark Otto @mdo
2 Jacob Thornton @fat
3 Larry the Bird @twitter

2. Striped table

Get a little fancy with your tables by adding zebra-striping—just add the .table-striped class.

Note: Striped tables use the :nth-child CSS selector and is not available in IE7-IE8.

<table class="table table-striped">
# First Name Last Name Username
1 Mark Otto @mdo
2 Jacob Thornton @fat
3 Larry the Bird @twitter

3. Bordered table

Add borders around the entire table and rounded corners for aesthetic purposes.

<table class="table table-bordered">
# First Name Last Name Username
1 Mark Otto @mdo
Mark Otto @TwBootstrap
2 Jacob Thornton @fat
3 Larry the Bird @twitter

4. Condensed table

Make your tables more compact by adding the .table-condensed class to cut table cell padding in half (from 8px to 4px).

<table class="table table-condensed">
# First Name Last Name Username
1 Mark Otto @mdo
2 Jacob Thornton @fat
3 Larry the Bird @twitter

5. Combine them all!

Feel free to combine any of the table classes to achieve different looks by utilizing any of the available classes.

<table class="table table-striped table-bordered table-condensed">
Full name
# First Name Last Name Username
1 Mark Otto @mdo
2 Jacob Thornton @fat
3 Larry the Bird @twitter

/// Flexible HTML and CSS

The best part about forms in Bootstrap is that all your inputs and controls look great no matter how you build them in your markup. No superfluous HTML is required, but we provide the patterns for those who require it.

More complicated layouts come with succinct and scalable classes for easy styling and event binding, so you're covered at every step.

/// Four layouts included

Bootstrap comes with support for four types of form layouts:

  • Vertical (default)
  • Search
  • Inline
  • Horizontal

Different types of form layouts require some changes to markup, but the controls themselves remain and behave the same.

/// Control states and more

Bootstrap's forms include styles for all the base form controls like input, textarea, and select you'd expect. But it also comes with a number of custom components like appended and prepended inputs and support for lists of checkboxes.

States like error, warning, and success are included for each type of form control. Also included are styles for disabled controls.

/// Four types of forms

Bootstrap provides simple markup and styles for four styles of common web forms.

Name Class Description
Vertical (default) .form-vertical (not required) Stacked, left-aligned labels over controls
Inline .form-inline Left-aligned label and inline-block controls for compact style
Search .form-search Extra-rounded text input for a typical search aesthetic
Horizontal .form-horizontal Float left, right-aligned labels on same line as controls

/// Example forms using just form controls, no extra markup

Basic form

With v2.0, we have lighter and smarter defaults for form styles. No extra markup, just form controls.

Associated help text!

Example block-level help text here.

<form class="well">
  <label>Label name</label>
  <input type="text" class="span3" placeholder="Type something">
  <span class="help-inline">Associated help text!</span>
  <label class="checkbox">
    <input type="checkbox"> Check me out
  <button type="submit" class="btn">Submit</button>

Search form

Reflecting default WebKit styles, just add .form-search for extra rounded search fields.

<form class="well form-search">
  <input type="text" class="input-medium search-query">
  <button type="submit" class="btn">Search</button>

Inline form

Inputs are block level to start. For .form-inline and .form-horizontal, we use inline-block.

<form class="well form-inline">
  <input type="text" class="input-small" placeholder="Email">
  <input type="password" class="input-small" placeholder="Password">
  <label class="checkbox">
    <input type="checkbox"> Remember me
  <button type="submit" class="btn">Sign in</button>

/// Horizontal forms

Controls Bootstrap supports

In addition to freeform text, any HTML5 text-based input appears like so.

Example markup

Given the above example form layout, here's the markup associated with the first input and control group. The .control-group, .control-label, and .controls classes are all required for styling.

<form class="form-horizontal">
    <legend>Legend text</legend>
    <div class="control-group">
      <label class="control-label" for="input01">Text input</label>
      <div class="controls">
        <input type="text" class="input-xlarge" id="input01">
        <p class="help-block">Supporting help text</p>

What's included

Shown on the left are all the default form controls we support. Here's the bulleted list:

  • text inputs (text, password, email, etc)
  • checkbox
  • radio
  • select
  • multiple select
  • file input
  • textarea

New defaults with v2.0

Up to v1.4, Bootstrap's default form styles used the horizontal layout. With Bootstrap 2, we removed that constraint to have smarter, more scalable defaults for any form.

Form control states
Some value here
Something may have gone wrong
Please correct the error

Redesigned browser states

Bootstrap features styles for browser-supported focused and disabled states. We remove the default Webkit outline and apply a box-shadow in its place for :focus.

Form validation

It also includes validation styles for errors, warnings, and success. To use, add the error class to the surrounding .control-group.

  class="control-group error">

Extending form controls

Use the same .span* classes from the grid system for input sizes.

You may also use static classes that don't map to the grid, adapt to the responsive CSS styles, or account for varying types of controls (e.g., input vs. select).


Here's some help text

Here's more help text

Note: Labels surround all the options for much larger click areas and a more usable form.

Prepend & append inputs

Input groups—with appended or prepended text—provide an easy way to give more context for your inputs. Great examples include the @ sign for Twitter usernames or $ for finances.

Checkboxes and radios

Up to v1.4, Bootstrap required extra markup around checkboxes and radios to stack them. Now, it's a simple matter of repeating the <label class="checkbox"> that wraps the <input type="checkbox">.

Inline checkboxes and radios are also supported. Just add .inline to any .checkbox or .radio and you're done.

Inline forms and append/prepend

To use prepend or append inputs in an inline form, be sure to place the .add-on and input on the same line, without spaces.

Form help text

To add help text for your form inputs, include inline help text with <span class="help-inline"> or a help text block with <p class="help-block"> after the input element.

/// Our Twitter Feed

Find out what's happening, right now, with the people and organizations you care about.

Visit link
© Copyright © 2013.Company name All rights reserved. Collect from 网站模板
友情链接:中国诺网  |上海爱商自动化设备有限公司  |胶东新闻网中医频道  |六分网  |服装  |深圳诚泰金属材料有限公司  |东莞市金之林知识产权有限公司  |东莞市金之林知识产权有限公司  |中华人民共和国环境保护部  |东莞市山蟑螂业余捕捉小组  |天津滨海人才网  |天津滨海人才网  |胶东新闻网中医频道  |东莞市金之林知识产权有限公司  |走途  |河南红星机器厂  |我乐电影网  |走途  |合肥教  |中国诺网  |上海启趣网络科技有限公司  |东海龙  |中维药  |佛山市顺德区科里诚电源科技有限公司  |梁家腐化厂  |深圳市胜牌电线电缆分公司  |上海启趣网络科技有限公司  |上海静衡称重设备有限公司  |佛山市顺德区科里诚电源科技有限公司  |六分网  |服装  |深圳诚泰金属材料有限公司  |山东乔泰管业科技有限公司  |太子参直销有限公司  |沂水县树昌水果购销处  |东莞市金之林知识产权有限公司  |走途  |胶东新闻网中医频道  |中国诺网  |山东乔泰管业科技有限公司  |衡水赶  |邢台信息港  |泰士特  |衡水赶  |衡水赶  |东莞市金之林知识产权有限公司  |成都木意印象商贸有限公司  |武汉易田电气设备有限公司(武汉)  |太子参直销有限公司  |走途  |中华人民共和国环境保护部  |在线网  |山东济宁沃尔华集团公司  |走途  |邢台信息港  |蓝孚高  |中华人民共和国环境保护部  |东莞市金之林知识产权有限公司  |宝鸡市第一中学  |胶东新闻网中医频道  |上海静衡称重设备有限公司  |东莞市金之林知识产权有限公司  |走途  |胶东新闻网中医频道  |中国诺网  |山东乔泰管业科技有限公司  |衡水赶  |拉拉勾  |赣州市叁多教学设备有限公司  |南宁中考招生信息网  |上海新昌卷帘门加工厂  |山东乔泰管业科技有限公司  |PS游戏中文网  |东莞花鱼童话服饰有限公司  |上海爱商自动化设备有限公司  |衡水赶  |合肥教  |山东济宁沃尔华集团公司  |东莞市海量不锈钢水箱有限公司  |上海新昌卷帘门加工厂  |   网站地图