.sr-only
the CSS class of the Bootstrap library is used to make things disappear on computer screens only. Is there any opposite class for it to make things disappear on mobiles only?
I know there could be several workarounds using Javascript scripts. These are acceptable if and only if there is no opposite.
.sr-only
the CSS class of the Bootstrap library is used to make things disappear on computer screens only. Is there any opposite class for it to make things disappear on mobiles only?
I know there could be several workarounds using Javascript scripts. These are acceptable if and only if there is no opposite.
Share Improve this question edited Aug 25, 2015 at 2:25 Chris Martin 30.7k12 gold badges80 silver badges140 bronze badges asked Jun 18, 2014 at 15:16 Mohammad Areeb SiddiquiMohammad Areeb Siddiqui 10.2k16 gold badges73 silver badges118 bronze badges 5 |3 Answers
Reset to default 8Bootstrap responsive utilities will handle this: http://getbootstrap.com/css/#responsive-utilities
Hide on extra small screens screens (less than 768px):
class="hidden-xs"
Show on extra small and small screens (less than 992px):
class="visible-xs visible-sm"
Using Bootstrap 4 you could use class="d-md-none"
. As this would set display:none
to the element from the md width and up.
If you want to display the element only on large and medium screens and hide on small and extra-small screens this are the classes you have to add in the element using bootstrap v4: d-none d-md-block
.
Here is the full answer for your question if you are using Bootstrap v4: https://getbootstrap.com/docs/4.4/migration/#responsive-utilities
sr-only
is a class used to hide text which is placed for screen readers. It is not visible on computer screens or mobiles. See stackoverflow.com/questions/19758598/…. You really should be using the Bootstrap grid system. What exactly are you trying to do? – Matt Commented Jun 18, 2014 at 15:20.sr-only
does what you think it does. The.hidden-xs
class that is built into bootstrap is probably what you want: getbootstrap.com/css/#responsive-utilities – Steve Sanders Commented Jun 18, 2014 at 15:29class="visible-xs visible-sm"
– Steve Sanders Commented Jun 18, 2014 at 16:41