Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!--:
References
https://www.w3.org/TR/wai-aria-practices/examples/combobox/aria1.1pattern/listbox-combo.html
https://alphagov.github.io/accessible-autocomplete/examples/
-->

<div class="wvui-card wvui-typeahead-search">
  <form id="wvui-typeahead-search__search" class="wvui-search-form" action="//wikipedia.org/search-redirect.php" role="combobox" aria-expanded="true" aria-haspopup="listbox" aria-owns="wvui-typeahead-search__suggestions">
    <input type="hidden" name="family" value="wikipedia">
    <input type="hidden" name="language" value="en">

    <label class="wvui-cue" for="wvui-typeahead-search__input">
      Search Wikipedia
    </label>
    <input
           id="wvui-typeahead-search__input"
           class="wvui-input"
           name="search"
           type="search"
           size="48"
           autofocus="autofocus"
           accesskey="f"
           title="Search Wikipedia [Alt+Shift+f]"
           dir="auto"
           autocomplete="off"
           aria-describedby="wvui-typeahead-search__cue"
           value="ba"
           aria-autocomplete="list"
           aria-controls="wvui-typeahead-search__suggestions"
           >

    <!-- Additional instructions can be presented to screen readers when search suggestions
        will be presented. -->
    <div id="wvui-typeahead-search__cue" class="wvui-cue">
      Input your query and press enter or tap the search button to search within pages.
      Suggestions may be presented on query change. Use up and down arrow keys to
      navigate the suggestions and press enter or tap to select.
    </div>

    <!--
     This button will not be presented in T244392 but may be wanted conditionally within
     the component for other use cases.
     <button class="wvui-button" type="submit">
      Search
     </button>
    -->
  </form>

  <!-- A data list is not used because of limited styling options. An ordered list is used over
      an unordered list because the contents are ordered by relevance which may be useful
      semantically and to screen readers. -->
  <ol id="wvui-typeahead-search__suggestions" class="wvui-typeahead-search__suggestions" role="listbox">
    <li role="option">
      <a href="/wiki/Banana" class="wvui-typeahead-suggestion">
        <img
             class="wvui-typeahead-suggestion__thumbnail"
             src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/de/Bananavarieties.jpg/160px-Bananavarieties.jpg"
             width="160"
             height="91"
             alt="Banana"
             loading="lazy"
             >
        <h3 class="wvui-typeahead-suggestion__title">
          <em class="wvui-typeahead-suggestion__matching-title">Ba</em>nana
        </h3>
        <p class="wvui-typeahead-suggestion__description">
          Edible fruit
        </p>
      </a>
    </li>
    <!-- More results here. -->
  </ol>

  <button class="wvui-button wvui-typeahead-search__submit" form="wvui-typeahead-search__search" type="submit">
    Search pages containing <em>ba</em>
  </button>
</div>

              
            
!

CSS

              
                .wvui-typeahead-search__suggestions {
  /* Don't present list numbers to GUI readers. */
  list-style: none;
}

.wvui-typeahead-suggestion {
  /* Fill the available width fully so the whole suggestion box is clickable. */
  display: block;
  width: 100%;
}

.wvui-typeahead-suggestion::after {
  /* Add an empty pseudo-element that clears the left and right so that the element can wrap
  its contents fully even if they're floated. */
  content: "";
  clear: both;

  /* Make the pseudo-element dimensionless, forbid scrollbars, and hide. */
  display: block;
  width: 0;
  height: 0;
  overflow: hidden;
  visibility: hidden;
}

.wvui-typeahead-suggestion__thumbnail {
  /* Thumbnails appear to the starting side of title and description. */
  float: left;
}

/* Informational cues intended for presentation to screen readers only. */
.wvui-cue {
  /* Make the element dimensionless, forbid scrollbars, and hide visually. */
  display: block;
  width: 0;
  height: 0;
  overflow: hidden;
  visibility: hidden;
}
              
            
!

JS

              
                
              
            
!
999px

Console