cards.md 8.6 KB
Newer Older
C
chomik 已提交
1 2
---
title: Cards
C
chomik 已提交
3
menu: docs.cards
C
chomik 已提交
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
description: A card is a flexible and extensible content container. It includes options for headers and footers, a wide variety of content, contextual background colors, and powerful display options. 
---

The `.card` element is simply a container with a shadow, a border, a radius, and some padding. Built with flexbox, they offer easy alignment and mix well with other Bootstrap components.

### Default card

{% example html columns=1 %}
{% include cards/card.html hide-options=true %}
{% endexample %}

### Advanced card

{% example html columns=1 %}
{% include cards/card.html show-buttons=true show-footer=true %}
{% endexample %}

### Blog post card

The best way to make your post eye-catching is adding an image to it. To do so, just add the image with the `.card-img-top` class. We've added the `.d-flex .flex-column` classes to the `.card-body` to have the author details be on the bottom of the card.

{% example html columns=1 %}
{% include cards/blog-single.html type="image" %}
{% endexample %}

### Row deck

If you want to create a couple of posts next to each other, add the `.row-deck` class to `.row`—then they will all have the same height.

M
mrszympek 已提交
33
{% example html columns=3 %}
34
<div class="row row-deck">
C
chomik 已提交
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
    <div class="col-md-4">
        <div class="card">
            <div class="card-body">Short content</div>
        </div>
    </div>
    <div class="col-md-4">
        <div class="card">
            <div class="card-body">Extra long content of card. Lorem ipsum dolor sit amet, consetetur sadipscing elitr</div>
        </div>
    </div>
    <div class="col-md-4">
        <div class="card">
            <div class="card-body">Short content</div>
        </div>
    </div>
</div>
{% endexample %}

### Post card with aside image

You can also add the image on the left side of the card. All you need do to is: add the `.card-aside` class to the element with the `.card` class. Then add the image in the `.card-aside-column` element. No worries, tabler will automatically center it and scale to right size:

M
mrszympek 已提交
57
{% example html columns=3 %}
C
chomik 已提交
58 59 60 61 62
{% include cards/blog-single.html type="aside" liked=1 %}
{% endexample %}

### Color variations

M
mrszympek 已提交
63
{% example html columns=3 %}
64
<div class="row row-deck">
M
mrszympek 已提交
65 66 67 68 69
    <div class="col-md-4">
        {% include cards/card.html title="Card status on top" hide-options=true status-position="top" status-color="red" body="Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam deleniti fugit incidunt, iste, itaque minima neque" %}
    </div>
    <div class="col-md-4">
        {% include cards/card.html title="Card status on left side" hide-options=true status-position="left" status-color="blue" body="Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam deleniti fugit incidunt, iste, itaque minima neque"  %}
C
chomik 已提交
70
    </div>
M
mrszympek 已提交
71 72
    <div class="col-md-4">
        {% include cards/card.html title="Card status on bottom" hide-options=true status-position="bottom" status-color="green" body="Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam deleniti fugit incidunt, iste, itaque minima neque"  %}
C
chomik 已提交
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
    </div>
</div>
{% endexample %}


### Card with switch

{% example html columns=1 %}
{% include cards/card.html title="Card with switch" show-switch=true %}
{% endexample %}

### Card with loader

{% example html columns=1 %}
{% include cards/card.html title="Card with loader" hide-options=true show-loader=true %}
{% endexample %}
M
mrszympek 已提交
89

M
mrszympek 已提交
90
### Card with badge on image
M
mrszympek 已提交
91

M
mrszympek 已提交
92
{% example html columns=3 %}
M
mrszympek 已提交
93 94 95 96 97
<div class="card flex-row flex-row-reverse">
	<div class="media media-4x3 col-4">
		<a class="media-content " style="background-image:url({% include ui/image.html id=7 %})">
		</a>
		<div class="media-overlay overlay-top">
C
codecalm 已提交
98
			<a href="#"><span class="badge badge-md text-uppercase bg-yellow">NATURE</span></a>
M
mrszympek 已提交
99 100 101 102 103 104
		</div>
		<div class="media-action ">
		</div>
	</div>
	<div class="card-body d-flex flex-column">
		<div class="flex-fill ">
C
codecalm 已提交
105
			<a href="#" class="card-title text-md">
M
mrszympek 已提交
106 107 108 109 110 111 112 113 114 115 116
				It’s 2018, and the race is on between tech giants to decide who will control what you see every time you open your eyes
			</a>
			<a class="text-muted mt-2 ">What Not To Wear: The Hats, Scarves In History</a>
		</div>
		<div class="">
			<div class="text-muted text-sm">Feb 28, 10:54 am</div>
		</div>
	</div>
</div>
{% endexample %}

M
mrszympek 已提交
117 118
### Card with badge

M
mrszympek 已提交
119
{% example html columns=3 %}
M
mrszympek 已提交
120 121 122 123 124 125 126 127 128 129
<div class="card flex-row">
	<div class="media media-4x3 col-5">
		<a class="media-content " style="background-image:url({% include ui/image.html id=13 %})">
		</a>
		<div class="media-action ">
		</div>
	</div>
	<div class="card-body d-flex flex-column ">
		<div class="flex-fill ">
			<div class="mb-3">
C
codecalm 已提交
130
				<a href="#">
M
mrszympek 已提交
131 132 133
					<span class="badge badge-md text-uppercase bg-danger">Fashion</span>
				</a>
			</div>
C
codecalm 已提交
134
			<a href="#" class="card-title h-2x">
M
mrszympek 已提交
135 136 137 138 139 140 141 142 143 144 145 146
				What Not To Wear: The Hats, Scarves In History
			</a>
		</div>
		<div class="">
			<div class="text-muted text-sm">Feb 26, 1:49 am</div>
		</div>
	</div>
</div>
{% endexample %}



M
mrszympek 已提交
147 148
### Card with aside image

M
mrszympek 已提交
149
{% example html columns=3 %}
M
mrszympek 已提交
150 151 152 153
<div class="card flex-row">
	<div class="media media-4x3 col-4">
		<a class="media-content" style="background-image:url({% include ui/image.html id=6 %})"></a>
		<div class="media-overlay overlay-top">
C
codecalm 已提交
154
			<a href="#"><span class="badge badge-md text-uppercase bg-white-overlay">MUSIC</span></a>
M
mrszympek 已提交
155 156 157 158 159 160
		</div>
		<div class="media-action ">
		</div>
	</div>
	<div class="card-body d-flex flex-column">
		<div class="flex-fill">
C
codecalm 已提交
161
			<a href="#" class="card-title text-md">
M
mrszympek 已提交
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
				Radio Listeners Prepare For An Impending Alien Invasion In This Visually Stunning Short Film
			</a>
			<a class="text-muted mt-2">What Not To Wear: The Hats, Scarves In History</a>
		</div>
		<div class="text-muted text-sm">Feb 22, 11:38 am</div>
	</div>
</div>
{% endexample %}

### Card with image
{% example html columns=1 %}
<div class="card">
	<img class="card-img-top" src="{{ site.base }}/img/photos/{{ site.data.photos[17].file }}" alt="Card image cap">
	<div class="card-body">
		<h5 class="card-title">Card title that wraps to a new line</h5>
		<p class="card-text">This is a longer card with supporting text below as a natural lead-in to
			additional content. This content is a little bit longer.</p>
		<div class="text-muted text-sm">Feb 28, 10:54 am</div>
	</div>
</div>
{% endexample %}

### Quote card

{% example html columns=1 %}
<div class="card">
  <cardquote class="cardquote text-white bg-primary mb-0 card-body">
	 <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
	 <footer class="cardquote-footer">
		 <small>
			 Someone famous in <cite title="Source Title">Source Title</cite>
		 </small>
	 </footer>
  </cardquote>
  </div>
{% endexample %}

### Another Card

{% example html columns=3 %}
<div class="row row-deck">
   <div class="col-6">
      <div class="card text-center">
         <div class="card-body">
            <h5 class="card-title">Card title</h5>
            <p class="card-text">This card has supporting text below as a natural lead-in to additional
               content.</p>
            <p class="card-text">
               <small class="text-muted">Last updated 3 mins ago</small>
            </p>
         </div>
      </div>
   </div>
   <div class="col-6">
      <div class="card text-right">
         <div class="card-body">
            <h5 class="card-title">Card title</h5>
            <p class="card-text">This card has supporting text below as a natural lead-in to additional
               content.</p>
            <p class="card-text">
               <small class="text-muted">Last updated 3 mins ago</small>
            </p>
         </div>
      </div>
   </div>
</div>
{% endexample %}

### Image card

{% example html columns=1 %}
<div class="card">
	<img class="card-img" src="{{ site.base }}/img/photos/{{ site.data.photos[19].file }}" alt="Card image">
</div>
{% endexample %}
 
M
mrszympek 已提交
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
### Card with options
{% example html columns=1 %}
	{% include cards/card.html title="This is a standard card" show-footer=true %}
{% endexample %}

### Card with fullscreen
{% example html columns=1 %}
	{% include cards/card.html title="With additional fullscreen button" show-fullscreen=true %}
{% endexample %}

### Card with search
{% example html columns=1 %}
	{% include cards/card.html title="Card with search form" show-form=true %}
{% endexample %}

### Card with search
M
mrszympek 已提交
254
{% example html columns=3 %}
M
mrszympek 已提交
255 256 257 258 259 260 261 262 263 264 265
	<div class="row">
	  <div class="col-lg-6 col-xl-6">
		  {% include cards/card.html title="Card with alert" alert="Adding action was successful" %}
	  </div>
	  <div class="col-lg-6 col-xl-6">
		  {% include cards/card.html title="Card with alert" alert="Adding action failed" alert-type="danger" %}
	  </div>
	</div>
{% endexample %}