-
-
Notifications
You must be signed in to change notification settings - Fork 79k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Having ".hidden-sm hidden-md" only hides content for medium and not for small devices #8883
Comments
The problem seems to be in responsive-utilities.less, lines 52 and 55 where Either (1) I'd go with 1 and just remove the |
I am seeing this same issue. |
Glad to see that I'm not the only one with this issue. Same problem here as well. |
Quick Fix or possible work around. |
@eratzlaff that's not a workaround, that's the intent as far as I know. I don't think the |
@mbleigh the use of two <div>Using hidden</div>
<div class="hidden-sm hidden-md">hidden-sm hidden-md</div>
<div class="hidden-sm hidden-lg">hidden-sm hidden-lg</div>
<div class="hidden-md hidden-lg">hidden-md hidden-lg</div>
<div>Theoretical equivalent using visible</div>
<div class="visible-lg">hidden-sm hidden-md</div>
<div class="visible-md">hidden-sm hidden-lg</div>
<div class="visible-sm">hidden-md hidden-lg</div> |
@eratzlaff right, because they aren't meant to be used in combination. The documentation never alludes to being able to apply multiple hidden classes and since there are only three sizes, the visible classes provide the exact same functionality. I'm saying it's not a bug, it's the intent of the library to work this way. |
@mbleigh As long there are only three sizes. If you add a 4 size |
We won't be changing anything here to account for this right now—they're not to be mixed. I'd be open to exploring how to fix this though, but right now I don't see an easy way. These utilities are meant for super quick access to toggling content as-needed. If you need something more advanced, roll your own until an elegant and straightforward solution can be found. I doubt we'll have that for the final v3 though. |
I think I got the solution for combination of 2 and 3 class together for hidden and visible. .visible-lg {
@media (max-width: @screen-phone-max) {
.responsive-invisibility();
}
&.visible-xs {
@media (max-width: @screen-phone-max) {
.responsive-visibility();
}
}
@media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) {
.responsive-invisibility();
}
&.visible-sm {
@media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) {
.responsive-visibility();
}
}
@media (min-width: @screen-desktop) and (max-width: @screen-desktop-max) {
.responsive-invisibility();
}
&.visible-md {
@media (min-width: @screen-desktop) and (max-width: @screen-desktop-max) {
.responsive-visibility();
}
}
@media (min-width: @screen-large-desktop) {
.responsive-visibility();
}
} What do you think about @mdo?? |
@mdo If you think it's ok I make the pull request. |
@iagdotme If you want to cover all the possibilities you need to add another 4 more. .visible-xs {
@media (max-width: @screen-phone-max) {
.responsive-visibility();
}
@media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) {
.responsive-invisibility();
}
@media (min-width: @screen-desktop) and (max-width: @screen-desktop-max) {
.responsive-invisibility();
}
@media (min-width: @screen-large-desktop) {
.responsive-invisibility();
}
}
.visible-sm {
@media (max-width: @screen-phone-max) {
.responsive-invisibility();
}
&.visible-xs {
@media (max-width: @screen-phone-max) {
.responsive-visibility();
}
}
@media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) {
.responsive-visibility();
}
@media (min-width: @screen-desktop) and (max-width: @screen-desktop-max) {
.responsive-invisibility();
}
@media (min-width: @screen-large-desktop) {
.responsive-invisibility();
}
}
.visible-md {
@media (max-width: @screen-phone-max) {
.responsive-invisibility();
}
&.visible-xs {
@media (max-width: @screen-phone-max) {
.responsive-visibility();
}
}
@media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) {
.responsive-invisibility();
}
&.visible-sm {
@media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) {
.responsive-visibility();
}
}
@media (min-width: @screen-desktop) and (max-width: @screen-desktop-max) {
.responsive-visibility();
}
@media (min-width: @screen-large-desktop) {
.responsive-invisibility();
}
}
.visible-lg {
@media (max-width: @screen-phone-max) {
.responsive-invisibility();
}
&.visible-xs {
@media (max-width: @screen-phone-max) {
.responsive-visibility();
}
}
@media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) {
.responsive-invisibility();
}
&.visible-sm {
@media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) {
.responsive-visibility();
}
}
@media (min-width: @screen-desktop) and (max-width: @screen-desktop-max) {
.responsive-invisibility();
}
&.visible-md {
@media (min-width: @screen-desktop) and (max-width: @screen-desktop-max) {
.responsive-visibility();
}
}
@media (min-width: @screen-large-desktop) {
.responsive-visibility();
}
} for hidden its the same idea. |
@eratzlaff I haven't been able to test your code but it seems right. The reason I listed only 14 classes as that gives you all the possibilities without duplication. There are pros and cons with both approaches. Yours gives you all possibilities of hidden and visible and makes more sense semantically. It does result in more code though. My example cuts down on the amount of code needed. Personally I prefer your solution, but it's whether simplifying and reducing the amount of code is more important. I do feel implementing a full list of responsive utility classes for BS3 is very important, but I guess it depends where on the scale this lies. |
|
@eratzlaff that's my version of fix for subj with a little bit smaller code. May be useful for you It's work like in your solution.. We can mix few or more classes of each subgroup (visible or hidden). Example: <div class="visible-xs visible-md">Visible on medium and extra small only</div>
<div class="hidden-xs hidden-md">Visible on small and large only</div> Fix: .visible-xs,
.visible-sm,
.visible-md,
.visible-lg {
.responsive-invisibility();
}
.visible-xs {
@media (max-width: @screen-tablet) {
.responsive-visibility();
}
}
.visible-sm {
@media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) {
.responsive-visibility();
}
}
.visible-md {
@media (min-width: @screen-desktop) and (max-width: @screen-desktop-max) {
.responsive-visibility();
}
}
.visible-lg {
@media (min-width: @screen-large-desktop) {
.responsive-visibility();
}
}
.hidden-xs,
.hidden-sm,
.hidden-md,
.hidden-lg {
.responsive-visibility();
}
.hidden-xs {
@media (max-width: @screen-tablet) {
.responsive-invisibility();
}
}
.hidden-sm {
@media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) {
.responsive-invisibility();
}
}
.hidden-md {
@media (min-width: @screen-desktop) and (max-width: @screen-desktop-max) {
.responsive-invisibility();
}
}
.hidden-lg {
@media (min-width: @screen-large-desktop) {
.responsive-invisibility();
}
} |
@turchenkoalex can you compile a css file please :/ it would be greatly appreciated thank you ;) |
@turchenkoalex Great 👍 its work fine. I prefer you code. It much much more easier to understand. @iagdotme All combination = 14 👍 |
@cloud1250000 Yep! It's already compiled and you can get it from https://github.com/TurchenkoAlex/bootstrap/tree/3.0.0-wip/dist/css |
This is looking good! @eratzlaff I was working in binary (my brain is funny like that!) - |
@mdo Why weren't the classes meant to be combined? What if I want something to show up only on mobile devices? |
Punting for a 3.1 release, and tracking as part of #9397. |
Old post, but I recently had this problem and have a quick solution that avoids having to dig into any CSS. Instead of putting multiple .hidden-* classes in one element, make nested elements and assign each one its own class. This probably isn't best practice, but it gets the job done!
As far as I can tell, this only behaves as expected with hidden-, not visible- |
In 3.0.0-rc1 having an element with the
hidden-sm hidden-md
classes will only hide it for medium devices and not for small ones as well.The text was updated successfully, but these errors were encountered: