From eaeee93fa34092ee7c107d75edffd6c8274c15fb Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Sun, 9 Aug 2015 23:38:16 -0700 Subject: docs rearrange --- docs/content/code.md | 53 ++++ docs/content/figures.md | 25 ++ docs/content/images.md | 80 ++++++ docs/content/reboot.md | 286 +++++++++++++++++++++ docs/content/tables.md | 611 +++++++++++++++++++++++++++++++++++++++++++++ docs/content/typography.md | 256 +++++++++++++++++++ 6 files changed, 1311 insertions(+) create mode 100644 docs/content/code.md create mode 100644 docs/content/figures.md create mode 100644 docs/content/images.md create mode 100644 docs/content/reboot.md create mode 100644 docs/content/tables.md create mode 100644 docs/content/typography.md (limited to 'docs/content') diff --git a/docs/content/code.md b/docs/content/code.md new file mode 100644 index 000000000..fd149d4b0 --- /dev/null +++ b/docs/content/code.md @@ -0,0 +1,53 @@ +--- +layout: page +title: Code +group: content +--- + +Styles for inline code snippets and longer, multiline blocks of code. + +## Contents + +* Will be replaced with the ToC, excluding the "Contents" header +{:toc} + +## Inline code + +Wrap inline snippets of code with `code`. Be sure to escape HTML angle brackets. + +{% example html %} +For example, <section> should be wrapped as inline. +{% endexample %} + +## Preformatted text + +Or, code blocks. Use `
`s for multiple lines of code. Once again, be sure to escape any angle brackets in the code for proper rendering. You may optionally add the `.pre-scrollable` class, which will set a max-height of 350px and provide a y-axis scrollbar.
+
+{% example html %}
+
<p>Sample text here...</p>
+{% endexample %} + +## Variables + +For indicating variables use the `` tag. + +{% example html %} +y = mx + b +{% endexample %} + +## User input + +Use the `` to indicate input that is typically entered via keyboard. + +{% example html %} +To switch directories, type cd followed by the name of the directory.
+To edit settings, press ctrl + , +{% endexample %} + +## Sample output + +For indicating blocks sample output from a program use the `` tag. + +{% example html %} +This text is meant to be treated as sample output from a computer program. +{% endexample %} diff --git a/docs/content/figures.md b/docs/content/figures.md new file mode 100644 index 000000000..e37b7241e --- /dev/null +++ b/docs/content/figures.md @@ -0,0 +1,25 @@ +--- +layout: page +title: Images +group: content +--- + +Anytime you need to display a piece of content—like an image—with an optional caption, consider using a `
`. + +Use the included `.figure` and `.figure-caption` classes to provide some baseline styles for the HTML5 `
` and `
` elements. As a bonus, immediate children images are automatically responsive. + +{% example html %} +
+ A generic square placeholder image with rounded corners in a figure. +
A caption for the above image.
+
+{% endexample %} + +Aligning the figure's caption is easy with our [text utilities](). + +{% example html %} +
+ A generic square placeholder image with rounded corners in a figure. +
A caption for the above image.
+
+{% endexample %} diff --git a/docs/content/images.md b/docs/content/images.md new file mode 100644 index 000000000..210158dcd --- /dev/null +++ b/docs/content/images.md @@ -0,0 +1,80 @@ +--- +layout: page +title: Images +group: content +--- + +Opt your images into responsive behavior (so they never become larger than their parent elements) and add lightweight styles to them—all via classes. + +## Contents + +* Will be replaced with the ToC, excluding the "Contents" header +{:toc} + +## Responsive images + +Images in Bootstrap are made responsive with `.img-responsive`. `max-width: 100%;` and `height: auto;` are applied to the image so that it scales with the parent element. + +
+ Generic responsive image +
+ +{% highlight html %} +Responsive image +{% endhighlight %} + +{% callout warning %} +#### SVG images and IE 9-10 + +In Internet Explorer 9-10, SVG images with `.img-responsive` are disproportionately sized. To fix this, add `width: 100% \9;` where necessary. Bootstrap doesn't apply this automatically as it causes complications to other image formats. +{% endcallout %} + +## Image shapes + +Add classes to an `` element to easily style images in any project. + +
+ A generic square placeholder image with rounded corners + A generic square placeholder image where only the portion within the circle circumscribed about said square is visible + A generic square placeholder image with a white border around it, making it resemble a photograph taken with an old instant camera +
+ +{% highlight html %} +... +... +... +{% endhighlight %} + +## Aligning images + +Align images with the [helper float classes](/components/helpers) or [text alignment classes](/components/helpers). A simple centering class can also be used for `block` level images. + +
+ A generic square placeholder image with rounded corners + A generic square placeholder image with rounded corners +
+ +{% highlight html %} +... +... +{% endhighlight %} + +
+ A generic square placeholder image with rounded corners +
+ +{% highlight html %} +... +{% endhighlight %} + +
+
+ A generic square placeholder image with rounded corners +
+
+ +{% highlight html %} +
+ ... +
+{% endhighlight %} diff --git a/docs/content/reboot.md b/docs/content/reboot.md new file mode 100644 index 000000000..3d0568846 --- /dev/null +++ b/docs/content/reboot.md @@ -0,0 +1,286 @@ +--- +layout: page +title: Reboot +group: content +--- + +Part of Bootstrap's job is to provide an elegant, consistent, and simple baseline to build upon. We use Reboot, a collection of element-specific CSS changes in a single file, to kickstart that. + +Reboot builds upon Normalize, providing many HTML elements with somewhat opinionated styles using only element selectors. Additional styling is done only with classes. For example, we reboot some `` styles for a simpler baseline and later provide `.table`, `.table-bordered`, and more. + +## Contents + +* Will be replaced with the ToC, excluding the "Contents" header +{:toc} + +## Approach + +Here are our guidelines and reasons for choosing what to override in Reboot: + +- Update some browser default values to use `rem`s instead of `em`s for scalable component spacing. +- Avoid `margin-top`. Vertical margins can collapse, yielding unexpected results. More importantly though, a single direction of `margin` is a simpler mental model. +- For easier scaling across device sizes, block elements should use `rem`s for `margin`s. +- Keep declarations of `font`-related properties to a minimal, using `inherit` whenever possible. + +## Page defaults + +The `` and `` elements are updated to provide better page-wide defaults. More specifically: + +- The `box-sizing` is globally set on every element—including `*:before` and `*after`, to `border-box`. This ensures that the declared width of element is never exceeded due to padding or border. +- A base `font-size: 16px` is declared on the `` and `font-size: 1rem` on the `` for easy responsive type-scaling via media queryies. +- The `` also sets a global `font-family` and `line-height`. This is inherited later by some form elements to prevent font inconsistencies. +- For safety, the `` has a declared `background-color`, defaulting to `#fff`. + +## Headings and paragraphs + +All heading elements—e.g., `

`—and `

` are reset to have their `margin-top` removed. Headings have `margin-bottom: .5rem` added and paragraphs `margin-bottom: 1rem` for easy spacing. + +

+{% markdown %} +# h1 heading +Curabitur blandit tempus porttitor. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. + +## h2 heading +Curabitur blandit tempus porttitor. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. + +### h3 heading +Curabitur blandit tempus porttitor. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. + +#### h4 heading +Curabitur blandit tempus porttitor. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. + +##### h5 heading +Curabitur blandit tempus porttitor. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. + +###### h6 heading +Curabitur blandit tempus porttitor. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. +{% endmarkdown %} +
+ +## Lists + +All lists—`
    `, `
      `, and `
      `—have their `margin-top` removed and a `margin-bottom: 1rem`. Nested lists have no `margin-bottom`. + +
      +{% markdown %} +* Lorem ipsum dolor sit amet +* Consectetur adipiscing elit +* Integer molestie lorem at massa +* Facilisis in pretium nisl aliquet +* Nulla volutpat aliquam velit + * Phasellus iaculis neque + * Purus sodales ultricies + * Vestibulum laoreet porttitor sem + * Ac tristique libero volutpat at +* Faucibus porta lacus fringilla vel +* Aenean sit amet erat nunc +* Eget porttitor lorem + +1. Lorem ipsum dolor sit amet +2. Consectetur adipiscing elit +3. Integer molestie lorem at massa +4. Facilisis in pretium nisl aliquet +5. Nulla volutpat aliquam velit +6. Faucibus porta lacus fringilla vel +7. Aenean sit amet erat nunc +8. Eget porttitor lorem +{% endmarkdown %} +
      + +For simpler styling, clear hierarchy, and better spacing, description lists have updated `margin`s. `
      `s reset `margin-left` to `0` and add `margin-bottom: .5rem`. `
      `s are **bolded**. + +
      +{% markdown %} +
      +
      Description lists
      +
      A description list is perfect for defining terms.
      +
      Euismod
      +
      Vestibulum id ligula porta felis euismod semper eget lacinia odio sem.
      +
      Donec id elit non mi porta gravida at eget metus.
      +
      Malesuada porta
      +
      Etiam porta sem malesuada magna mollis euismod.
      +
      +{% endmarkdown %} +
      + +## Preformatted text + +The `
      ` element is reset to remove its `margin-top` and use `rem` units for its `margin-bottom`.
      +
      +
      +{% markdown %} +
      +.element {
      +  margin-bottom: 1rem;
      +}
      +
      +{% endmarkdown %} +
      + +## Tables + +Tables are slightly adjusted to style `

`s appear light or dark gray. + +{% example html %} +
`s and ensure consistent `text-align` throughout. Additional changes for borders, padding, and more come with [the `.table` class](/components/tables/). + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ This is an example table, and this is its caption to describe the contents. +
Table headingTable headingTable headingTable heading
Table cellTable cellTable cellTable cell
Table cellTable cellTable cellTable cell
Table cellTable cellTable cellTable cell
+
+ +## Forms + +Various form elements have been rebooted for simpler base styles. Here are some of the most notable changes: + +- `
`s have no borders, padding, or margin so they can be easily used as wrappers for individual inputs or groups of inputs. +- ``s, like fieldsets, have also been restyled to be displayed as a heading of sorts. +- `
+ + +## Misc elements + +### Address + +The `
` element is updated to reset the browser default `font-style` from `italic` to `normal`. `line-height` is also now inherited, and `margin-bottom: 1rem` has been added. `
`s are for presenting contact information for the nearest ancestor (or an entire body of work). Preserve formatting by ending lines with `
`. + +
+
+ Twitter, Inc.
+ 1355 Market St, Suite 900
+ San Francisco, CA 94103
+ P: (123) 456-7890 +
+ +
+ Full Name
+ first.last@example.com +
+
+ +### Blockquote + +The default `margin` on blockquotes is `1em 40px`, so we reset that to `0 0 1rem` for something more consistent with other elements. + +
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.

+
Someone famous in Source Title
+
+
+ +### Inline elements + +The `` element receives basic styling to make it stand the amongst paragraph text. + +
+ Nulla attr vitae elit libero, a pharetra augue. +
diff --git a/docs/content/tables.md b/docs/content/tables.md new file mode 100644 index 000000000..5de8a8c28 --- /dev/null +++ b/docs/content/tables.md @@ -0,0 +1,611 @@ +--- +layout: page +title: Tables +group: content +--- + +Due to the widespread use of tables across third-party widgets like calendars and date pickers, we've designed our tables to be **opt-in**. Just add the base class `.table` to any ``. + +## Contents + +* Will be replaced with the ToC, excluding the "Contents" header +{:toc} + +## Basic example + +{% example html %} +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#First NameLast NameUsername
1MarkOtto@mdo
2JacobThornton@fat
3Larrythe Bird@twitter
+{% endexample %} + +## Inverse table + +{% example html %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#First NameLast NameUsername
1MarkOtto@mdo
2JacobThornton@fat
3Larrythe Bird@twitter
+{% endexample %} + +## Table head options + +Use one of two modifier classes to make `
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#First NameLast NameUsername
1MarkOtto@mdo
2JacobThornton@fat
3Larrythe Bird@twitter
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#First NameLast NameUsername
1MarkOtto@mdo
2JacobThornton@fat
3Larrythe Bird@twitter
+{% endexample %} + +## Striped rows + +Use `.table-striped` to add zebra-striping to any table row within the ``. + +{% example html %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#First NameLast NameUsername
1MarkOtto@mdo
2JacobThornton@fat
3Larrythe Bird@twitter
+{% endexample %} + +## Bordered table + +Add `.table-bordered` for borders on all sides of the table and cells. + +{% example html %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#First NameLast NameUsername
1MarkOtto@mdo
2MarkOtto@TwBootstrap
3JacobThornton@fat
4Larry the Bird@twitter
+{% endexample %} + +## Hoverable rows + +Add `.table-hover` to enable a hover state on table rows within a ``. + +{% example html %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#First NameLast NameUsername
1MarkOtto@mdo
2JacobThornton@fat
3Larry the Bird@twitter
+{% endexample %} + +## Small table + +Add `.table-sm` to make tables more compact by cutting cell padding in half. + +{% example html %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#First NameLast NameUsername
1MarkOtto@mdo
2JacobThornton@fat
3Larry the Bird@twitter
+{% endexample %} + +## Contextual classes + +Use contextual classes to color table rows or individual cells. + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ClassDescription
+ .table-active + Applies the hover color to a particular row or cell
+ .table-success + Indicates a successful or positive action
+ .table-info + Indicates a neutral informative change or action
+ .table-warning + Indicates a warning that might need attention
+ .table-danger + Indicates a dangerous or potentially negative action
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#Column headingColumn headingColumn heading
1Column contentColumn contentColumn content
2Column contentColumn contentColumn content
3Column contentColumn contentColumn content
4Column contentColumn contentColumn content
5Column contentColumn contentColumn content
6Column contentColumn contentColumn content
7Column contentColumn contentColumn content
8Column contentColumn contentColumn content
9Column contentColumn contentColumn content
+
+ +{% highlight html %} + +... +... +... +... +... + + + + ... + ... + ... + ... + ... + +{% endhighlight %} + +## Responsive tables + +Create responsive tables by wrapping any `.table` in `.table-responsive` to make them scroll horizontally on small devices (under 768px). When viewing on anything larger than 768px wide, you will not see any difference in these tables. + +{% callout warning %} +#### Vertical clipping/truncation + +Responsive tables make use of `overflow-y: hidden`, which clips off any content that goes beyond the bottom or top edges of the table. In particular, this can clip off dropdown menus and other third-party widgets. +{% endcallout %} + +{% callout warning %} +#### Firefox and fieldsets + +Firefox has some awkward fieldset styling involving `width` that interferes with the responsive table. This cannot be overriden without a Firefox-specific hack that we **don't** provide in Bootstrap: + +{% highlight css %} +@-moz-document url-prefix() { + fieldset { display: table-cell; } +} +{% endhighlight %} + +For more information, read [this Stack Overflow answer](https://stackoverflow.com/questions/17408815/fieldset-resizes-wrong-appears-to-have-unremovable-min-width-min-content/17863685#17863685). +{% endcallout %} + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#Table headingTable headingTable headingTable headingTable headingTable heading
1Table cellTable cellTable cellTable cellTable cellTable cell
2Table cellTable cellTable cellTable cellTable cellTable cell
3Table cellTable cellTable cellTable cellTable cellTable cell
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#Table headingTable headingTable headingTable headingTable headingTable heading
1Table cellTable cellTable cellTable cellTable cellTable cell
2Table cellTable cellTable cellTable cellTable cellTable cell
3Table cellTable cellTable cellTable cellTable cellTable cell
+
+
+ +{% highlight html %} +
+ + ... +
+
+{% endhighlight %} + + +### Reflow + +{% example html %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#Table headingTable headingTable headingTable headingTable headingTable heading
1Table cellTable cellTable cellTable cellTable cellTable cell
2Table cellTable cellTable cellTable cellTable cellTable cell
3Table cellTable cellTable cellTable cellTable cellTable cell
+{% endexample %} diff --git a/docs/content/typography.md b/docs/content/typography.md new file mode 100644 index 000000000..299edc570 --- /dev/null +++ b/docs/content/typography.md @@ -0,0 +1,256 @@ +--- +layout: page +title: Typography +group: content +--- + +Bootstrap includes simple and easily customized typography for headings, body text, lists, and more. For even more control, check out the [textual utility classes](/components/utilities/). + +## Contents + +* Will be replaced with the ToC, excluding the "Contents" header +{:toc} + +## Global settings + +Bootstrap sets basic global display, typography, and link styles. Specifically, we: + +- Set `background-color: #fff;` on the `` +- Use the `@font-family-base`, `@font-size-base`, and `@line-height-base` attributes as our typographic base +- Set the global link color via `@link-color` and apply link underlines only on `:hover` + +These styles can be found within `scaffolding.less`. + + +## Headings + +All HTML headings, `

` through `

`, are available. `.h1` through `.h6` classes are also available, for when you want to match the font styling of a heading but still want your text to be displayed inline. + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +

h1. Bootstrap heading

Semibold 36px

h2. Bootstrap heading

Semibold 30px

h3. Bootstrap heading

Semibold 24px

h4. Bootstrap heading

Semibold 18px
h5. Bootstrap heading
Semibold 14px
h6. Bootstrap heading
Semibold 12px
+
+ +{% highlight html %} +

h1. Bootstrap heading

+

h2. Bootstrap heading

+

h3. Bootstrap heading

+

h4. Bootstrap heading

+
h5. Bootstrap heading
+
h6. Bootstrap heading
+{% endhighlight %} + +Create lighter, secondary text in any heading with a generic `` tag or the `.small` class. + +
+ + + + + + + + + + + + + + + + + + + + + +

h1. Bootstrap heading Secondary text

h2. Bootstrap heading Secondary text

h3. Bootstrap heading Secondary text

h4. Bootstrap heading Secondary text

h5. Bootstrap heading Secondary text
h6. Bootstrap heading Secondary text
+
+ +{% highlight html %} +

h1. Bootstrap heading Secondary text

+

h2. Bootstrap heading Secondary text

+

h3. Bootstrap heading Secondary text

+

h4. Bootstrap heading Secondary text

+
h5. Bootstrap heading Secondary text
+
h6. Bootstrap heading Secondary text
+{% endhighlight %} + +## Display headings + +Traditional heading elements are designed to work best in the meat of your page content. When you need a heading to stand out, consider using a **display heading**—a larger, slightly more opinionated heading style. + +
+ + + + + + + + + + + + + + + +

Display 4

Display 3

Display 2

Display 1

+
+ + +## Lead + +Make a paragraph stand out by adding `.lead`. + +{% example html %} +

+ Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus. +

+{% endexample %} + +## Inline text elements + +Styling for common inline HTML5 elements. + +{% example html %} +

You can use the mark tag to highlight text.

+

This line of text is meant to be treated as deleted text.

+

This line of text is meant to be treated as no longer accurate.

+

This line of text is meant to be treated as an addition to the document.

+

This line of text will render as underlined

+

This line of text is meant to be treated as fine print.

+

This line rendered as bold text.

+

This line rendered as italicized text.

+{% endexample %} + +While not shown above, feel free to use `` and `` in HTML5. `` is meant to highlight words or phrases without conveying additional importance while `` is mostly for voice, technical terms, etc. + +## Abbreviations + +Stylized implementation of HTML's `` element for abbreviations and acronyms to show the expanded version on hover. Abbreviations with a `title` attribute have a light dotted bottom border and a help cursor on hover, providing additional context on hover and to users of assistive technologies. + +Add `.initialism` to an abbreviation for a slightly smaller font-size. + +{% example html %} +

attr

+

HTML

+{% endexample %} + +## Blockquotes + +For quoting blocks of content from another source within your document. Wrap `
` around any HTML as the quote. For straight quotes, we recommend a `

`. + +{% example html %} +

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.

+
+{% endexample %} + +### Naming a source + +Add a `