# :visible Selector

## visible ( ) version added: 1.0

Description: Selects all elements that are visible.

Elements are considered visible if they consume space in the document. Visible elements have a width or height that is greater than zero.

Elements with `visibility: hidden` or `opacity: 0` are considered visible, since they still consume space in the layout.

Elements that are not in a document are considered to be hidden; jQuery does not have a way to know if they will be visible when appended to a document since it depends on the applicable styles.

During animations that hide an element, the element is considered to be visible until the end of the animation. During animations to show an element, the element is considered to be visible at the start at the animation.

How `:visible` is calculated was changed in jQuery 1.3.2. The release notes outline the changes in more detail.

## Examples:

#### Example: Make all visible divs turn yellow on click.

    <!doctype html>
    <html lang="en">
    <head>
      <meta charset="utf-8">
      <title>css demo</title>

      <style>

      div {
        width: 50px;
        height: 40px;
        margin: 5px;
        border: 3px outset green;
        float: left;
      }
      .starthidden {
        display: none;
      }

      </style>

      <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    </head>
    <body>

    <button>Show hidden to see they don't change</button>
    <div></div>
    <div class="starthidden"></div>
    <div></div>
    <div></div>
    <div style="display:none;"></div>

    <script>

    $( "div:visible" ).click(function() {
      $( this ).css( "background", "yellow" );
    });
    $( "button" ).click(function() {
      $( "div:hidden" ).show( "fast" );
    });

    </script>

    </body>
    </html>

#### Demo: