What is sr-only in Bootstrap 3?

后端 未结 6 780
猫巷女王i
猫巷女王i 2020-11-22 09:23

What is the class sr-only used for? Is it important or can I remove it? Works fine without.

Here\'s my example:

6条回答
  •  忘了有多久
    2020-11-22 10:27

    The .sr-only class hides an element to all devices except screen readers:

    Skip to main content Combine .sr-only with .sr-only-focusable to show the element again when it is focused

    .sr-only {
    border: 0 !important;
    clip: rect(1px, 1px, 1px, 1px) !important; /* 1 */
    -webkit-clip-path: inset(50%) !important;
        clip-path: inset(50%) !important;  /* 2 */
    height: 1px !important;
    margin: -1px !important;
    overflow: hidden !important;
    padding: 0 !important;
    position: absolute !important;
    width: 1px !important;
    white-space: nowrap !important;            /* 3 */
    

    }

提交回复
热议问题