Codebase 3.0.1
Main Menu  

Cards

Codebase cards are a flexbox implementation of Nicole Sullivan’s media objects, with some added features for a wide range of applications.

The Simplest Card

Card Title

Lorem ipsum dolor sit amet, vis in blandit singulis, an unum doming facilisi vim. Facete aliquam bonorum id quo, ex labore tincidunt mel, usu no quod liberavisse. Ex sea dolorum insolens assueverit, sed ut harum latine dignissim. Vis cibo vidit ea, eu duo debet platonem explicari, pro ex graece meliore. Illum graeci inciderint mei et, ei decore nostro vim.

Note: Codebase cards have no decorative styling – you are free to add your own, or use Codebase utility classes for margin, border, padding, background color, etc.

<div class="card">

  <a href="" class="card-image card-image-left">
    <img src="" alt="">
  </a>

  <div class="card-body">
    <h4>Card Title</h4>
    <p>Lorem ipsum dolor sit amet...</p>
  </div>

</div>

Card images can have .card-image-left or .card-image-right. This changes the flexbox order of the image. However, if your card image spans the whole width of the card, then you don’t need these modifier classes.

Horizontal or Vertical Cards

By default, cards display their main content (the image and the body) arranged horizontally, as 'columns'. But if your card image is wide enough, or if the card width is (constrained) narrow enough, then the card columns wrap to become rows.

Card Title

Lorem ipsum dolor sit amet, adipiscing honestatis ius ut, nisl consulatu pro in.

Card Title

Lorem ipsum dolor sit amet, adipiscing honestatis ius ut, nisl consulatu pro in.

Card Title

Lorem ipsum dolor sit amet, adipiscing honestatis ius ut, nisl consulatu pro in.

<div class="card">

  <a href="" class="card-image">
    <img src="" alt="">
  </a>

  <div class="card-body">
    <h4>Card Title</h4>
    <p>Lorem ipsum dolor sit amet...</p>
  </div>

</div>

Also, you can force card layout to become vertical even if your card image is too narrow, by adding the modifier class .card-vertical to the component container.

Card Title

Lorem ipsum dolor sit amet, vis in blandit singulis, an unum doming facilisi vim. Facete aliquam bonorum id quo, ex labore tincidunt mel, usu no quod liberavisse. Ex sea dolorum insolens assueverit, sed ut harum latine dignissim. Vis cibo vidit ea, eu duo debet platonem explicari, pro ex graece meliore. Illum graeci inciderint mei et, ei decore nostro vim.

Additionally, for vertically arranged cards (accomplished by either mothod above) you can set .card-image-top or .card-image-bottom – instead of setting .card-image-left or .card-image-right.

Card Title

Lorem ipsum dolor sit amet, vis in blandit singulis, an unum doming facilisi vim. Facete aliquam bonorum id quo, ex labore tincidunt mel, usu no quod liberavisse. Ex sea dolorum insolens assueverit, sed ut harum latine dignissim. Vis cibo vidit ea, eu duo debet platonem explicari, pro ex graece meliore. Illum graeci inciderint mei et, ei decore nostro vim.

Card Title

Lorem ipsum dolor sit amet, vis in blandit singulis, an unum doming facilisi vim. Facete aliquam bonorum id quo, ex labore tincidunt mel, usu no quod liberavisse. Ex sea dolorum insolens assueverit, sed ut harum latine dignissim. Vis cibo vidit ea, eu duo debet platonem explicari, pro ex graece meliore. Illum graeci inciderint mei et, ei decore nostro vim.

Codebase cards can easily accommodate headers and footers, using .card-header and .card-footer.

Header

Card Title

Lorem ipsum dolor sit amet, adipiscing honestatis ius ut, nisl consulatu pro in. Imperdiet evertitur no usu, his te suavitate salutatus.

Header

Card Title

Lorem ipsum dolor sit amet, adipiscing honestatis ius ut, nisl consulatu pro in. Imperdiet evertitur no usu, his te suavitate salutatus.

<div class="card">

  <div class="card-header">Header</div>

  <a href="" class="card-image card-image-right" >
    <img src="" alt="">
  </a>

  <div class="card-body">
    <h4>Card Title</h4>
    <p>Lorem ipsum dolor sit amet...</p>
  </div>

  <div class="card-footer">Footer</div>

</div>

If your require multiple mid-sections within your card, comply use a few .card-section classed elements instead of one .card-body.

Header

Card Title

Lorem ipsum dolor sit amet, adipiscing honestatis ius ut, nisl consulatu pro in.
Imperdiet evertitur no usu, his te suavitate salutatus.
Nullam ridens deterruisset an duo.
Cum harum insolens ei, cum probo placerat praesent et.

Card Overlay

The class .card-overlay can be used to insert a block of (e.g. text) on a layer over the other content within the card (e.g. over the image).

.card-overlay-top

Card overlay text (top)

.card-overlay-middle

Card overlay text (middle)

.card-overlay-bottom

Card overlay text (bottom)

Notes on usage of the card overlay:

  1. The card overlay must have less/smaller content than the other content that it is overlaying. (In these examples above: an image is being overlayed by text – too much text would stick out beyond the image.)
  2. If you need to use the card overlay with the header header and/or footer, be aware of the fact that the overlay will overlay the header and/or footer too. If this is a problem for your design, then you need to add an extra container around the overlay, and give it CSS position: relative. (But exclude the header and/or footer from this extra container.)

Cards With Constrained Height

If the height of a card is constrained (by a stated height on itself or on a container), then the .card-body has auto overflow scrolling (vertical). (Note: .card-section does not have this same behavior.)

Header

This Card has a Scrollable Body

Lorem ipsum dolor sit amet, vis in blandit singulis, an unum doming facilisi vim. Facete aliquam bonorum id quo, ex labore tincidunt mel, usu no quod liberavisse. Ex sea dolorum insolens assueverit, sed ut harum latine dignissim.

Vis cibo vidit ea, eu duo debet platonem explicari, pro ex graece meliore. Illum graeci inciderint mei et, ei decore nostro vim.

Movet voluptaria voluptatum has at, qui cu timeam ancillae democritum. Ad veniam detraxit his. In est bonorum fabulas deleniti, eam ex soluta verear albucius. Sale aperiri repudiandae eu cum, at cum sint dicunt. Prima tibique constituto cum ne, quidam dolorem detraxit pro no, sea an aeque zril.

Et ponderum tacimates vim. Laudem ornatus intellegam no cum. Porro omittantur pro te. Iisque mandamus ei eum. Pri idque iudico appetere ex. Has no altera veritus civibus.

At civibus aliquando usu. Vide libris has ut, eum illum luptatum ad. Quando scripta nusquam est te. Eleifend principes pertinacia sed cu, vix ut meis diceret salutandi, ea inermis ocurreret voluptatibus eam. Ei vidisse conclusionemque eam, vix eros mediocrem at. Graeco laboramus te mea, ius fabellas consequat voluptatum et.

Cards Can Be Nested

There may be some circumstances where you need to "nest" cards – or place smaller card(s) "inside" a bigger card. As Codebase cards are media objects, you would expect to be able to do this and you can, easily.

Card Title

Lorem ipsum dolor sit amet, vis in blandit singulis, an unum doming facilisi vim. Facete aliquam bonorum id quo, ex labore tincidunt mel, usu no quod liberavisse. Ex sea dolorum insolens assueverit, sed ut harum latine dignissim. Vis cibo vidit ea, eu duo debet platonem explicari, pro ex graece meliore. Illum graeci inciderint mei et, ei decore nostro vim.

Card Title

Lorem ipsum dolor sit amet, vis in blandit singulis, an unum doming facilisi vim. Facete aliquam bonorum id quo, ex labore tincidunt mel, usu no quod liberavisse. Ex sea dolorum insolens assueverit, sed ut harum latine dignissim. Vis cibo vidit ea, eu duo debet platonem explicari, pro ex graece meliore. Illum graeci inciderint mei et, ei decore nostro vim.

Card Title

Lorem ipsum dolor sit amet, vis in blandit singulis, an unum doming facilisi vim. Facete aliquam bonorum id quo, ex labore tincidunt mel, usu no quod liberavisse. Ex sea dolorum insolens assueverit, sed ut harum latine dignissim. Vis cibo vidit ea, eu duo debet platonem explicari, pro ex graece meliore. Illum graeci inciderint mei et, ei decore nostro vim.

<div class="card">

  <a href="" class="card-image card-image-left" >
    <img src="" alt="Square Thumbnail">
  </a>

  <div class="card-body">
    <h4>Card Title</h4>
    <p>Lorem ipsum dolor sit amet...</p>

    <!-- Place nested `.card` here ... -->

  </div>

</div>

Card Classes

Class Explanation Modifiers
.card card component wrapper .card-vertical for vertical alignment of elements in the card body
.card-image card image class can be applied to the image itself, or to an anchor (hyperlink) wrapper. .card-left or .card-right
for cards with horizontally arranged body
.card-top or .card-bottom
for cards with vertically arranged body
.card-header Card header
.card-body Card body. For the main text content of the card.
.card-section Alternative for card body. Use when you reqire a "multi-segmented" card.
.card-footer Card footer
.card-overlay .card-overlay-top, .card-overlay-top or .card-overlay-bottom for positioning the content of the overlay

Width: [-sm][-md → -lg][-lg]