diff --git a/_includes/nav-css.html b/_includes/nav-css.html index 9d979bc90e..4d21a4f9fb 100644 --- a/_includes/nav-css.html +++ b/_includes/nav-css.html @@ -81,6 +81,7 @@
  • Quick floats
  • Clearfix
  • Screen reader content
  • +
  • Image replacement
  • diff --git a/css.html b/css.html index 3e639bf3b0..0d3fc11efd 100644 --- a/css.html +++ b/css.html @@ -2292,6 +2292,18 @@ For example, <section> should be wrapped as inline. } {% endhighlight %} + +

    Image replacement

    +

    Utilize the .text-hide class or mixin to help replace an element's text content with a background image.

    +{% highlight html %} +

    Custom heading

    +{% endhighlight %} + {% highlight css %} +// Usage as a Mixin +.heading { + .text-hide(); +} +{% endhighlight %} diff --git a/less/mixins.less b/less/mixins.less index c18e7c49b4..c5a7001566 100644 --- a/less/mixins.less +++ b/less/mixins.less @@ -69,7 +69,15 @@ } // CSS image replacement +// +// Heads up! v3 launched with with only `.hide-text()`, but per our pattern for +// mixins being reused as classes with the same name, this doesn't hold up. As +// of v3.0.1 we have added `.text-hide()` and deprecated `.hide-text()`. Note +// that we cannot chain the mixins together in Less, so they are repeated. +// // Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757 + +// Deprecated as of v3.0.1 (will be removed in v4) .hide-text() { font: ~"0/0" a; color: transparent; @@ -77,6 +85,14 @@ background-color: transparent; border: 0; } +// New mixin to use as of v3.0.1 +.text-hide() { + font: ~"0/0" a; + color: transparent; + text-shadow: none; + background-color: transparent; + border: 0; +} diff --git a/less/utilities.less b/less/utilities.less index 3d310e6515..a2807cc794 100644 --- a/less/utilities.less +++ b/less/utilities.less @@ -30,7 +30,7 @@ visibility: hidden; } .text-hide { - .hide-text(); + .text-hide(); }