Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>NOTE: as of August 2013, this has been fixed in Bootstrap, so the workarounds below are no longer necessary. (<a href="https://github.com/twbs/bootstrap/pull/9211" rel="nofollow">https://github.com/twbs/bootstrap/pull/9211</a>)</strong></p> <p>Bootstrap's responsive mixins aren't built to handle what you're trying to accomplish.</p> <p>Poke around in <a href="https://github.com/twbs/bootstrap/blob/08cd3072fc48d8b4ad7e9062cd5e9bbea1cc19da/less/responsive-utilities.less" rel="nofollow">responsive-utilities.less</a> and <a href="https://github.com/twbs/bootstrap/blob/08cd3072fc48d8b4ad7e9062cd5e9bbea1cc19da/less/mixins.less" rel="nofollow">mixins.less</a> and you'll see that the responsive utility classes (<code>.hidden-lg</code>,<code>.visible-lg</code>, etc.) don't actually contain any @media queries, so embedding them in your CSS won't make them respond to screen size changes. For these classes to work properly, they need to be added directly into your HTML.</p> <p>But as a workaround, you can copy Bootstrap's @media queries from <code>responsive-utilities.less</code> and directly apply the visibility mixins to your styles:</p> <pre><code>.promo-pod { /* Turn element off for all screens */ .responsive-invisibility(); /* Turn element back on for large screens */ @media (min-width: @screen-desktop) { .responsive-visibility(); } } </code></pre> <p>It's not a perfect solution, but it's the best you can do unless Bootstrap rearchitects their visible/hidden styles.</p> <p><strong>Edit (alternative solution)</strong>:</p> <p>If you'd like to use <code>.visible-sm</code>, <code>.visible-lg</code>, etc. directly in your CSS as you first asked, then add this snippet to your LESS file:</p> <pre><code>.visible-sm { .responsive-visibility(); @media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) { .responsive-invisibility(); } @media (min-width: @screen-desktop) { .responsive-invisibility(); } } .visible-md { .responsive-invisibility(); @media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) { .responsive-visibility(); } @media (min-width: @screen-desktop) { .responsive-invisibility(); } } .visible-lg { .responsive-invisibility(); @media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) { .responsive-invisibility(); } @media (min-width: @screen-desktop) { .responsive-visibility(); } } .hidden-sm { .responsive-invisibility(); @media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) { .responsive-visibility(); } @media (min-width: @screen-desktop) { .responsive-visibility(); } } .hidden-md { .responsive-visibility(); @media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) { .responsive-invisibility(); } @media (min-width: @screen-desktop) { .responsive-visibility(); } } .hidden-lg { .responsive-visibility(); @media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) { .responsive-visibility(); } @media (min-width: @screen-desktop) { .responsive-invisibility(); } } </code></pre> <p>Then you can do this:</p> <pre><code>.promo-pod { .visible-lg; } </code></pre> <p>It's simply a reorganization of Bootstrap's responsive utilities from <code>responsive-utilities.less</code>. (I may add a pull request to Bootstrap to see if something like this can get pulled into the master branch.)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload