DOCUMENTATION

Cards

Tailwind’s cards provide a flexible and extensible content container with multiple variants and option

Example

Cards are built with as little markup and styles as possible, but still manage to deliver a ton of control and customization. Built with flexbox, they offer easy alignment and mix well with other Bootstrap components. They have no margin by default, so use spacing utilities as needed.

Below is an example of a basic card with mixed content and a fixed width. Cards have no fixed width to start, so they’ll naturally fill the full width of its parent element. This is easily customized with our various sizing options.

Placeholder Image cap
Card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Go Somewhere

<div class=" mt-6">
<div class="max-w-xs mb-0 overflow-hidden rounded-lg shadow-lg">
<svg class="object-cover w-full h-48" width="100%" height="180" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" focusable="false">
    <title>Placeholder</title>
    <rect width="100%" height="100%" fill="#868e96"></rect><text x="40%" y="50%" fill="#dee2e6" dy=".3em">Image cap</text>
</svg>
<div class="px-6 py-4">
    <h5 class="mb-3 text-xl font-semibold text-black">Card title</h5>
    <p class="mb-4 text-gray-600">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    <a href="#" class="inline-flex justify-center px-6 py-2 text-sm font-medium text-white transition-all duration-500 ease-in-out bg-blue-500 border border-transparent rounded shadow-sm hover:shadow-lg hover:bg-blue-600 ">Go Somewhere</a>
</div>
</div>
</div>
   
        

Featured

Featured
Card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Go Somewhere
2 days ago

<div class="max-w-xs mb-0 overflow-hidden rounded-lg shadow-lg border border-white dark:border-secondary-800">
    <div class="p-6 pb-0 text-black dark:text-secondary-600 font-medium text-2xl">Featured</div>
    <div class="px-6 py-4">
        <h5 class="mb-3 text-xl font-medium text-black dark:text-secondary-600">Card
            title</h5>
        <p class="mb-4 text-secondary-600">Some quick example text to build on the
            card title and make up the bulk of the card's content.</p>
        <a href="#"
            class="inline-flex justify-center px-6 py-2 text-sm font-medium text-white transition-all duration-500 ease-in-out bg-blue-500 border border-transparent rounded shadow-sm hover:shadow-lg hover:bg-blue-600">Go
            Somewhere</a>

    </div>
    <div class="p-6 text-secondary-600 border-t border-white dark:border-secondary-800">2 days ago</div>
</div>        

Content types

Cards support a wide variety of content, including images, text, list groups, links, and more. Below are examples of what’s supported.

Titles, text, and links

Use the following simple card component with a title, text and link.

Card title

Some quick example text to build on the card title and make up the bulk of the card's content.

  • An item
  • A second item
  • A third item

<div class=" mt-6">
    <div class="max-w-xs mb-0 overflow-hidden rounded-lg shadow-lg">
    <div class="px-6 py-4">
        <h5 class="mb-3 text-xl font-semibold text-black">Card title</h5>
        <p class="mb-4 text-gray-600">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    </div>
    <ul>
        <li class="px-4 py-2 border-b">An item</li>
        <li class="px-4 py-2 border-b">A second item</li>
        <li class="px-4 py-2 ">A third item</li>
    </ul>
    <div class="px-6 py-4">
        <a href="#" class="text-blue-500">Card link</a>
        <a href="#" class="ml-6 text-blue-500">Another link</a>
    </div>
    </div>
</div>
            

List groups

Create lists of content in a card with a flush list group.

Card title

Some quick example text to build on the card title and make up the bulk of the card's content.

  • An item
  • A second item
  • A third item

<div class=" mt-6">
    <div class="max-w-xs mb-0 overflow-hidden rounded-lg shadow-lg">
    <div class="px-6 py-4">
        <h5 class="mb-3 text-xl font-semibold text-black">Card title</h5>
        <p class="mb-4 text-gray-600">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    </div>
    <ul>
        <li class="px-4 py-2 border-b">An item</li>
        <li class="px-4 py-2 border-b">A second item</li>
        <li class="px-4 py-2 ">A third item</li>
    </ul>
    <div class="px-6 py-4">
        <a href="#" class="text-blue-500">Card link</a>
        <a href="#" class="ml-6 text-blue-500">Another link</a>
    </div>
    </div>
</div>
            

Images

Cards include a few options for working with images. Choose from appending “image caps” at either end of a card, overlaying images with card content, or simply embedding the image in a card.

Placeholder Image cap
Card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Go Somewhere

<div class=" mt-6">
<div class="max-w-xs mb-0 overflow-hidden rounded-lg shadow-lg">
<svg class="object-cover w-full h-48" width="100%" height="180" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" focusable="false">
    <title>Placeholder</title>
    <rect width="100%" height="100%" fill="#868e96"></rect><text x="40%" y="50%" fill="#dee2e6" dy=".3em">Image cap</text>
</svg>
<div class="px-6 py-4">
    <h5 class="mb-3 text-xl font-semibold text-black">Card title</h5>
    <p class="mb-4 text-gray-600">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    <a href="#" class="inline-flex justify-center px-6 py-2 text-sm font-medium text-white transition-all duration-500 ease-in-out bg-blue-500 border border-transparent rounded shadow-sm hover:shadow-lg hover:bg-blue-600 ">Go Somewhere</a>
</div>
</div>
</div>
   
        

Horizontal

Using a combination of grid and utility classes, cards can be made horizontal in a mobile-friendly and responsive way.

Placeholder Image
Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

Last updated 3 mins ago


<div class=" mt-6">
    <div class="w-full max-w-xs overflow-hidden rounded-lg shadow-lg sm:flex">
    <div class="md:w-1/3">
        <svg class="object-cover w-full h-60" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" focusable="false">
        <title>Placeholder</title>
        <rect width="100%" height="100%" fill="#868e96"></rect><text x="30%" y="50%" fill="#dee2e6" dy=".3em">Image</text>
        </svg>
    </div>
    <div class="flex-1 px-6 py-4">
        <h5 class="mb-3 text-xl font-semibold text-black">Card title</h5>
        <p class="mb-4 text-gray-600">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
        <p class="mb-4 text-gray-700"><small class="text-muted">Last updated 3 mins ago</small></p>
    </div>
    </div>
</div>
            

Updated on February 28, 2022
Was this page helpful?