From 7c8d9551cc01536df505266218746655dc6a5a64 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Sat, 24 Aug 2013 14:40:24 -0700 Subject: [PATCH] fixes #9887: documents show and hide classes --- _includes/nav-css.html | 1 + css.html | 27 ++++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/_includes/nav-css.html b/_includes/nav-css.html index 4d21a4f9fb..7a6b459af1 100644 --- a/_includes/nav-css.html +++ b/_includes/nav-css.html @@ -80,6 +80,7 @@
  • Close icon
  • Quick floats
  • Clearfix
  • +
  • Showing and hiding content
  • Screen reader content
  • Image replacement
  • diff --git a/css.html b/css.html index c0169d574f..2933272cfc 100644 --- a/css.html +++ b/css.html @@ -2225,7 +2225,7 @@ For example, <section> should be wrapped as inline.

    Quick floats

    -

    Float an element to the left or right with a class. Classes can also be used as mixins.

    +

    Float an element to the left or right with a class. !important is included to avoid specificity issues. Classes can also be used as mixins.

    {% highlight html %}
    ...
    ...
    @@ -2280,6 +2280,31 @@ For example, <section> should be wrapped as inline. {% endhighlight %} +

    Showing and hiding content

    +

    Force an element to be shown or hidden via display with the use of .show and .hide classes. These classes use !important to avoid specificity conflicts, just like the quick floats. They are only available for block level toggling. They can also be used as mixins.

    +{% highlight html %} +
    ...
    +
    ...
    +{% endhighlight %} +{% highlight css %} +// Classes +.show { + display: block !important; +} +.hide { + display: none !important; +} + +// Usage as mixins +.element { + .show(); +} +.another-element { + .hide(); +} +{% endhighlight %} + +

    Screen reader content

    Hide an element to all users except screen readers with .sr-only. Necessary for following accessibility best practices. Can also be used as a mixin.

    {% highlight html %}