Basscss / Docs / Guides

UI Elements

Basscss can be used to create many different user interface elements out of the box. With utility styles and a thoughtfully-architected templating system, you can keep CSS bloat to a minimum, while making iterative design changes to partials and components. You don’t need to make CSS do your templating engine’s job.

Button Sizes

Button sizes can be adjusted with font size utilities.

<button type="button" class="h3 button-blue">Burgers</button>
<button type="button" class="h4 button-blue">Fries</button>
<button type="button" class="h6 button-blue">Shakes</button>

To change the line-height and padding but leave the font-size the same, use button size extensions. Font size utilities and button size extensions can be combined for more options.

<button type="button" class="button-big button-blue">Burgers</button>
<button type="button" class="button-blue">Fries</button>
<div class="mb1 md-hide"></div>
<button type="button" class="button-narrow button-blue">Onion Rings</button>
<button type="button" class="button-small button-blue">Shakes</button>

Pagination

Pagination is used to split up large lists in a user-friendly way and allows for deep linking. Use a combination of layout utilities and button styles to create navigation that suites your design.

<div class="clearfix">
  <a href="#!" class="left button button-nav-light">
    <svg class="icon" data-icon="chevron-left"></svg>
    Previous
  </a>
  <a href="#!" class="right button button-nav-light">
    Next
    <svg class="icon" data-icon="chevron-right"></svg>
  </a>
</div>

Responsive state utilities can be used to progressively enhance pagination with numbers on devices with wider viewports.

<div class="center">
  <div class="inline-block clearfix">
    <a href="#!" class="left button button-narrow button-nav-light">
      <svg class="icon" data-icon="chevron-left"></svg>
      Previous
    </a>
    <a href="#!" class="right button button-narrow button-nav-light">
      Next
      <svg class="icon" data-icon="chevron-right"></svg>
    </a>
    <div class="overflow-hidden sm-show">
      <a href="#!" class="button button-narrow button-nav-light is-active">1</a>
      <a href="#!" class="button button-narrow button-nav-light">2</a>
      <a href="#!" class="button button-narrow button-nav-light">3</a>
      <a href="#!" class="button button-narrow button-nav-light">4</a>
      <a href="#!" class="button button-narrow button-nav-light">5</a>
    </div>
  </div>
</div>

Standard color styles can be used to control the appearance.

<div class="center">
  <div class="inline-block overflow-hidden border rounded">
    <a href="#!" class="left button button-nav-light border-right">
      <svg class="icon" data-icon="chevron-left"></svg>
      Previous
    </a>
    <a href="#!" class="right button button-nav-light ">
      Next
      <svg class="icon" data-icon="chevron-right"></svg>
    </a>
    <div class="overflow-hidden sm-show">
      <a href="#!" class="left button button-nav-light dark-gray border-right">1</a>
      <a href="#!" class="left button button-nav-light border-right">2</a>
      <a href="#!" class="left button button-nav-light border-right">3</a>
    </div>
  </div>
</div>

Button Groups

Button groups allow for more flexibility in establishing gestalt and controlling information density. Use a combination of layout utilities and color extensions to create button groups. The utilities .rounded-left, .rounded-right, and .not-rounded can be used to override button and form field border radii.

<div class="inline-block clearfix">
  <button type="button" class="left button-blue rounded-left is-active">Burgers</button>
  <button type="button" class="left button-blue border-left not-rounded">Fries</button>
  <button type="button" class="left button-blue border-left rounded-right">Shakes</button>
</div>

Justified Button Group

The table object can be used to create justified button groups.

<div class="table table-fixed center">
  <a href="#!" class="table-cell button button-blue rounded-left is-active">Burgers</a>
  <a href="#!" class="table-cell button button-blue border-left not-rounded">Fries</a>
  <a href="#!" class="table-cell button button-blue border-left rounded-right">Shakes</a>
</div>

Normally, buttons with borders would double up when placed next to each other. The .x-group-item and .x-group-item-2 utilities adjust negative margins and focus states to visually collapse borders. Use the .x-group-item-2 utility on elements with 2px borders. Functionally, this is similar to how other frameworks handle button and form input groups, but with more direct control over styling.

<div class="inline-block clearfix">
  <button type="button" class="left button-blue-outline x-group-item-2 rounded-left is-active">Burgers</button>
  <button type="button" class="left button-blue-outline x-group-item-2 not-rounded">Fries</button>
  <button type="button" class="left button-blue-outline x-group-item-2 rounded-right">Shake</button>
</div>

Use .y-group-item and .y-group-item-2 to group elements vertically.

<div class="inline-block">
  <button type="button" class="block full-width button-blue-outline y-group-item-2 rounded-top is-active">Burgers</button>
  <button type="button" class="block full-width button-blue-outline y-group-item-2 not-rounded">Fries</button>
  <button type="button" class="block full-width button-blue-outline y-group-item-2 rounded-bottom">Shake</button>
</div>

Input Groups

Input groups can be created by removing margins, adjusting border radii, and using the group utilities. The .hide utility visually hides labels, while keeping them accessible to screen readers.

<form class="sm-col-6">
  <label class="hide">Pancakes</label>
  <input type="text" class="block full-width mb0 field-light rounded-top y-group-item" placeholder="Pancakes">
  <label class="hide">Making</label>
  <input type="password" class="block full-width mb0 field-light not-rounded y-group-item" placeholder="Making">
  <label class="hide">Bacon</label>
  <input type="text" class="block full-width field-light rounded-bottom y-group-item" placeholder="Bacon">
  <button type="submit" class="button-blue">Pancake</button>
</form>

The grid system can be used to control button or input group widths.

<form class="clearfix">
  <label class="hide">Bacon</label>
  <input type="text" class="col col-4 md-col-5 mb0 field-light rounded-left x-group-item" placeholder="Bacon">
  <label class="hide">Pancakes</label>
  <input type="password" class="col col-4 md-col-5 mb0 field-light not-rounded x-group-item" placeholder="Pancakes">
  <button type="submit" class="col col-4 md-col-2 button-blue rounded-right">Pancake</button>
</form>

Boxes

Boxes are used to group content and collections of application resources. Use combinations of layout utilities and color styles to create boxes.

Bacon

Bacon ipsum dolor sit amet chuck prosciutto landjaeger ham hock filet mignon shoulder hamburger pig venison. Ham bacon corned beef, sausage kielbasa flank tongue pig drumstick capicola swine short loin ham hock kevin.

<div class="md-col-6">
  <div class="p2 bg-white border rounded">
    <h1 class="h2 mt0">Bacon</h1>
    <p class="mb0">Bacon ipsum dolor sit amet chuck prosciutto landjaeger ham hock filet mignon shoulder hamburger pig venison. Ham bacon corned beef, sausage kielbasa flank tongue pig drumstick capicola swine short loin ham hock kevin.</p>
  </div>
</div>

To create headers and footers, set padding on nested divs then use color styles to control appearance.

Bacon with Header

Bacon ipsum dolor sit amet chuck prosciutto landjaeger ham hock filet mignon shoulder hamburger pig venison. Ham bacon corned beef, sausage kielbasa flank tongue pig drumstick capicola swine short loin ham hock kevin.

<div class="md-col-6">
  <div class="overflow-hidden bg-white border rounded">
    <div class="p2 bg-light-gray">
      <h1 class="h2 m0">Bacon with Header</h1>
    </div>
    <div class="p2">
      <p class="m0">Bacon ipsum dolor sit amet chuck prosciutto landjaeger ham hock filet mignon shoulder hamburger pig venison. Ham bacon corned beef, sausage kielbasa flank tongue pig drumstick capicola swine short loin ham hock kevin.</p>
    </div>
  </div>
</div>

Bacon with Image

Bacon ipsum dolor sit amet chuck prosciutto landjaeger ham hock filet mignon shoulder hamburger pig venison.

<div class="md-col-6">
  <div class="p2 bg-white border rounded">
    <img src="/docs/placeholder.svg" class="mb2">
    <h1 class="h2 mt0">Bacon with Image</h1>
    <p class="mb0">Bacon ipsum dolor sit amet chuck prosciutto landjaeger ham hock filet mignon shoulder hamburger pig venison.</p>
  </div>
</div>

Bacon with Header and Footer

Bacon ipsum dolor sit amet chuck prosciutto landjaeger ham hock filet mignon shoulder hamburger pig venison. Ham bacon corned beef, sausage kielbasa flank tongue pig drumstick capicola swine short loin ham hock kevin. Bacon t-bone hamburger turkey capicola rump short loin.

Turkey short loin tenderloin jerky.

<div class="md-col-6">
  <div class="overflow-hidden bg-white border rounded">
    <div class="p2 white bg-blue">
      <h1 class="h2 m0">Bacon with Header and Footer</h1>
    </div>
    <div class="p2">
      <p class="m0">Bacon ipsum dolor sit amet chuck prosciutto landjaeger ham hock filet mignon shoulder hamburger pig venison. Ham bacon corned beef, sausage kielbasa flank tongue pig drumstick capicola swine short loin ham hock kevin. Bacon t-bone hamburger turkey capicola rump short loin.</p>
    </div>
    <div class="p2 bg-darken-1">
      <p class="m0 h5">Turkey short loin tenderloin jerky.</p>
    </div>
  </div>
</div>

Flash Messages

Flash messages are used to provide feedback after the user has performed an action. Create custom flash messages with utilities and color styles.

Warning! Half-pound burger will be deleted
Onion rings cannot connect to the network
Fries added to order
<div class="bold center p2 mb2 white bg-red rounded">
  Warning! Half-pound burger will be deleted
</div>
<div class="bold center p2 mb2 bg-yellow rounded">
  Onion rings cannot connect to the network
</div>
<div class="bold center p2 white bg-green rounded">
  Fries added to order
</div>

Badges

Badges are used to represent properties and states and to tease quantities of resources behind navigation links. Button size extensions can be used in combination with other utilities and color styles to create badges.

Hamburger Fries

Hamburger Fries

Hamburger Fries

Hamburger Fries

Hamburger Fries
Hamburger Fries
<h1>Hamburger
  <span class="h2 inline-block button-small white bg-red rounded">Fries</span>
</h1>
<h2>Hamburger
  <span class="h3 inline-block button-small white bg-red rounded">Fries</span>
</h2>
<h3>Hamburger
  <span class="h4 inline-block button-small white bg-red rounded">Fries</span>
</h3>
<h4>Hamburger
  <span class="inline-block button-small white bg-red rounded">Fries</span>
</h4>
<h5>Hamburger
  <span class="inline-block button-small white bg-red rounded">Fries</span>
</h5>
<h6>Hamburger
  <span class="inline-block button-small white bg-red rounded">Fries</span>
</h6>

Color semantics can be controlled with color styles to represent different qualities of states.

Blue Red Yellow Green Mid Gray Bordered
<div>
  <span class="inline-block button-small white bg-blue rounded">Blue</span>
  <span class="inline-block button-small white bg-red rounded">Red</span>
  <span class="inline-block button-small bg-yellow rounded">Yellow</span>
  <span class="inline-block button-small white bg-green rounded">Green</span>
  <span class="inline-block button-small white bg-mid-gray rounded">Mid Gray</span>
  <span class="inline-block button-small border rounded">Bordered</span>
</div>
Button Sizes Navigation Breadcrumbs Pagination Button Groups Input Groups Dropdowns Navbars Boxes Flash Messages Badges

Learn More

Design Principles