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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Material Design Komponenten: Cards</title>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
</head>
<body>
<div class="content">
  <h2>Material Design Cards</h2>
  <div class="col-1">
    <h5>Standard-Layout</h5>
    <!-- Card example 01 -->
    <div class="body-01">Card Standard-Layout</div>
    <div class="card">
      <div class="optional-header">
        <div class="thumbnail thumbnail--40x40"><img src="https://upload.wikimedia.org/wikipedia/commons/8/89/Portrait_Placeholder.png" alt="" width="40" height="40"></div>
        <div class="primary-title">
          <div class="title">Title</div>
          <div class="subhead">Subhead</div>
        </div>
      </div>
      <div class="media media--16-9"> <img src="https://media.pixeltuner.de/wp-content/uploads/2018/06/Shapes-Abstraction-Background-2466799.jpg" alt="" width="640" height="426"> </div>
      <div class="primary-title">
        <div class="primary-text">Primary text goes here</div>
        <div class="secondary-text">Secondary text</div>
      </div>
      <div class="supporting-text">Supporting text include text like an article summary or a restaurant description.</div>
      <div class="actions">
        <div class="action-buttons">
          <button class="button" type="button">Action 1</button>
          <button class="button" type="button">Action 2</button>
        </div>
        <div class="action-icons float-right"> <i class="material-icons action-icon" role="button" title="Share">share</i> <i class="material-icons action-icon" role="button" title="More options">more_vert</i> </div>
      </div>
    </div>
  </div>
  <div class="col-2">
    <h5>Blog post</h5>
    <!-- Card example 02 -->
    <div class="body-01">Teaser/Feed</div>
    <div class="card">
      <div class="media media--80x80 float-right"> <img src="https://media.pixeltuner.de/wp-content/uploads/2018/06/aurora-1197755_640.jpg" alt="" width="640" height="426"> </div>
      <div class="primary-title">
        <div class="primary-text">Hundreds of New Planets Found</div>
        <div class="secondary-text">Astronomy</div>
      </div>
      <div class="supporting-text"> Supporting text include text like an article summary or a restaurant description.</div>
      <div class="actions">
        <div class="action-buttons">
          <button class="button" type="button">Read More</button>
        </div>
        <div class="action-icons float-right"> <i class="material-icons action-icon" role="button" title="Share">share</i> <i class="material-icons action-icon" role="button" title="More options">more_vert</i> </div>
      </div>
    </div>
    
    <!-- Card example 03 -->
    <div class="divider"></div>
    <div class="body-01">Post with comment field</div>
    <div class="card">
      <div class="media media--16-9">
        <div class="actions">
          <div class="action-icons float-right"> <i class="material-icons action-icon" role="button" title="Bookmark">bookmark_border</i> <i class="material-icons action-icon" role="button" title="Share">share</i> </div>
        </div>
        <div class="primary-title">
          <div class="secondary-text">Astronomy</div>
          <div class="primary-text">Hundreds of New Planets Found</div>
        </div>
        <img src="https://media.pixeltuner.de/wp-content/uploads/2018/06/aurora-1197755_640.jpg" alt="" width="640" height="426"> </div>
      <div class="optional-header">
        <div class="thumbnail thumbnail--40x40"><img src="https://randomuser.me/api/portraits/men/99.jpg" alt="" width="40" height="40"></div>
        <div class="primary-title">
          <div class="title">Dan West</div>
          <div class="subhead">Scientist</div>
        </div>
        <div class="action-icons"> <i class="material-icons action-icon" role="button" title="More options">more_vert</i> </div>
      </div>
      <div class="supporting-text"> Supporting text include text like an article summary or a restaurant description. Lorem ipsum dolor sit amet, vel ea quis suscipit. Modus scriptorem at sit, vix malorum appellantur eu an nec assum mazim pericula.</div>
      <div class="optional-header">
        <div class="thumbnail thumbnail--24x24"><img src="https://lh3.googleusercontent.com/-GvhDyQYoDZw/AAAAAAAAAAI/AAAAAAAAAAA/AIcfdXCR7Z9juYjHkI2MjHvfGmtowYerFw/s64-c-mo/photo.jpg" alt="" width="24" height="24"></div>
        <div class="primary-title"> 
          <!--          <div class="subhead">Kommentar hinzufügen ...</div>-->
          <textarea class="subhead" placeholder="Kommentar hinzufügen…" aria-label="Kommentar hinzufügen…" role="textbox"></textarea>
        </div>
      </div>
      <div class="actions">
        <div class="action-icons"> <i class="material-icons action-icon" role="button" title="Share">camera_alt</i> <i class="material-icons action-icon" role="button" title="More options">link</i> </div>
        <div class="action-buttons float-right">
          <button class="button" type="button">Cancel</button>
          <button class="button" type="button" disabled="">Post</button>
        </div>
      </div>
    </div>
  </div>
  <div class="col-3">
    <h5>Report</h5>
    <!-- Card example 04 -->
    <div class="body-01">Travel report (Big teaser)</div>
    <div class="card">
      <div class="media media--2-3">
        <div class="primary-title">
          <div class="optional-header">
            <div class="thumbnail thumbnail--40x40"><img src="https://randomuser.me/api/portraits/women/47.jpg" alt="" width="40" height="40"></div>
            <div class="primary-title">
              <div class="title">Emma Freeman</div>
              <div class="subhead">Travel Journalist</div>
            </div>
          </div>
          <div class="primary-text">The Many Lives Along the Yangtze River</div>
          <div class="secondary-text">Travel</div>
        </div>
        <img src="https://media.pixeltuner.de/wp-content/uploads/2018/06/asia-1793425_640.jpg" alt="" width="960" height="640"> </div>
      <div class="actions">
        <div class="action-buttons">
          <button class="button" type="button">Read report</button>
        </div>
        <div class="action-icons float-right"> <i class="material-icons action-icon" role="button" title="Share">share</i> <i class="material-icons action-icon" role="button" title="More options">more_vert</i> </div>
      </div>
    </div>
    <!-- Card example 05 -->
    <div class="divider"></div>
    <div class="body-01">Travel report (Small teaser)</div>
    <div class="card">
      <div class="media media--16-9">
        <div class="primary-title">
          <div class="primary-text">The Many Lives Along the Yangtze River</div>
          <div class="secondary-text">Travel</div>
        </div>
        <img src="https://media.pixeltuner.de/wp-content/uploads/2018/06/asia-1793425_640.jpg" alt="" width="640" height="426"> </div>
      <div class="actions">
        <div class="action-buttons">
          <button class="button" type="button">Read report</button>
        </div>
        <div class="action-icons float-right"> <i class="material-icons action-icon" role="button" title="Share">share</i> <i class="material-icons action-icon" role="button" title="More options">more_vert</i> </div>
      </div>
    </div>
  </div>
  <div class="col-4">
    <h5>Travel and events</h5>
    <!-- Card example 06 -->
    <div class="body-01">Book a hotel</div>
    <div class="card card__dark card__dark--magenta">
      <div class="media media--16-9"> <img src="https://media.pixeltuner.de/wp-content/uploads/2018/06/london-3078109_640.jpg" alt="" width="640" height="426"> </div>
      <div class="primary-title">
        <div class="primary-text float-right">$99</div>
        <div class="primary-text">Apple Apartments Limehouse</div>
        <div class="secondary-text">
          <div class="action-icons icon-color--yellow"> <i class="material-icons action-icon" role="button" title="Share">star</i> <i class="material-icons action-icon" role="button" title="More options">star</i> <i class="material-icons action-icon" role="button" title="More options">star</i></div>
          -Hotel</div>
      </div>
      <div class="supporting-text">London, 2.8 km to Tower Bridge</div>
      <div class="actions border-top">
        <div class="action-buttons float-right">
          <button class="button" type="button">View Details</button>
        </div>
        <div class="action-icons"> <i class="material-icons action-icon" role="button" title="Share">wifi</i> <i class="material-icons action-icon" role="button" title="More options">spa</i> <i class="material-icons action-icon" role="button" title="More options">pool</i></div>
      </div>
    </div>
    <!-- Card example 07 -->
    <div class="divider"></div>
    <div class="body-01">Book a hotel (Small)</div>
    <div class="card card__small card__dark card__dark--magenta">
      <div class="media"> <img src="https://media.pixeltuner.de/wp-content/uploads/2018/06/london-3078109_640.jpg" alt="" width="640" height="426"> </div>
      <div class="primary-title">
        <div class="primary-text">Apple Apartments Limehouse</div>
        <div class="secondary-text">June 21 - 28</div>
      </div>
      <div class="actions border-top">
        <div class="action-buttons">
          <button class="button" type="button">View Details</button>
        </div>
      </div>
    </div>
  </div>
</div>
</body>
</html>
              
            
!

CSS

              
                html {
	background-color: #ededed;
}
body {
	font-family: Roboto, sans-serif;
}
hr {
	background-color: rgba(0,0,0,0.12);
	border: none;
	height: 1px;
	margin: 0;
}
img {
	height: auto;
	width: 100%;
}
textarea {
	background: transparent;
	border: 0;
	font-family: Roboto, Arial, sans-serif;
	margin: 0;
	outline: none;
	padding: 0;
	position: relative;
	resize: none;
	top: 11px;
	word-wrap: break-word;
}
[class^='col-'] {
	float: left;
	padding: 0 0.5%;
}
h1 {
	font-size: 96px;
	font-weight: 300;
	letter-spacing: -1.5px;
}
h2 {
	font-size: 60px;
	font-weight: 300;
	letter-spacing: -0.5px;
}
h3 {
	font-size: 48px;
	font-weight: 400;
	letter-spacing: 0;
}
h4 {
	font-size: 34px;
	font-weight: 400;
	letter-spacing: 0.25px;
}
h5 {
	font-size: 24px;
	font-weight: 400;
	letter-spacing: 0;
}
h6 {
	font-size: 20px;
	font-weight: 500;
	letter-spacing: 0.15px;
}
.subtitle-01 {
	font-size: 16px;
	font-weight: 400;
	letter-spacing: 0.15px;
}
.subtitle-02 {
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 0.1px;
}
.body-01 {
	font-size: 16px;
	font-weight: 400;
	letter-spacing: 0.5px;
}
.body-02 {
	font-size: 14px;
	font-weight: 400;
	letter-spacing: 0.25px;
}
.caption {
	font-size: 12px;
	font-weight: 400;
	letter-spacing: 0.4px;
}
.overline {
	font-size: 10px;
	font-weight: 400;
	letter-spacing: 1.5px;
	text-transform: uppercase;
}
.button {
	background-color: transparent;
	border: none;
	-moz-border-radius: 2px;
	-webkit-border-radius: 2px;
	border-radius: 2px;
	color: inherit;
	cursor: pointer;
	display: inline-block;
	font-family: Roboto, sans-serif;
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 0.75px;
	line-height: 36px;
	min-width: 64px;
	padding: 0 8px;
	text-align: center;
	text-transform: uppercase;
}
.button, .action-icon {
	-webkit-transition: box-shadow .4s cubic-bezier(.25, .8, .25, 1), background-color .4s cubic-bezier(.25, .8, .25, 1);
	transition: box-shadow .4s cubic-bezier(.25, .8, .25, 1), background-color .4s cubic-bezier(.25, .8, .25, 1);
}
.button--raised {
	-moz-box-shadow: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);
	-webkit-box-shadow: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);
	box-shadow: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);
	-o-transition: box-shadow .28s cubic-bezier(.4, 0, .2, 1);
	-webkit-transition: 0 .28s cubic-bezier(.4, 0, .2, 1);
	transition: box-shadow .28s cubic-bezier(.4, 0, .2, 1), 0 .28s cubic-bezier(.4, 0, .2, 1);
}
.button--raised:focus, .button--raised:hover {
	-moz-box-shadow: 0 2px 4px -1px rgba(0,0,0,.2), 0 4px 5px 0 rgba(0,0,0,.14), 0 1px 10px 0 rgba(0,0,0,.12);
	-webkit-box-shadow: 0 2px 4px -1px rgba(0,0,0,.2), 0 4px 5px 0 rgba(0,0,0,.14), 0 1px 10px 0 rgba(0,0,0,.12);
	box-shadow: 0 2px 4px -1px rgba(0,0,0,.2), 0 4px 5px 0 rgba(0,0,0,.14), 0 1px 10px 0 rgba(0,0,0,.12);
}
.button--purple {
	background-color: #6200EE;
	color: #fff;
}
.button:hover, .action-icon:hover {
	background-color: rgba(158,158,158,0.2);
}
.button:active, .action-icon:active {
	background-color: rgba(158,158,158,0.4);
}
.button:focus:not(:active), .action-icon:focus:not(:active) {
	background-color: rgba(0,0,0,.12);
}
.button[disabled] {
	color: rgba(0,0,0,.26);
	cursor: default;
}
.button[disabled]:hover {
	background: none;
}
.action-buttons, .action-icons {
	display: inline-block;
	vertical-align: middle;
}
.action-icon {
	-moz-border-radius: 50%;
	-webkit-border-radius: 50%;
	border-radius: 50%;
	box-sizing: border-box;
	cursor: pointer;
	margin: 0 2px;
	outline: none;
	padding: 6px;
}
.action-icons {
	color: rgba(0,0,0,0.54);
}
.actions {
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	box-sizing: border-box;
	min-height: 52px;
	padding: 8px;
	position: relative;
	z-index: 1;
}
.divider {
	display: block;
	height: 24px;
}
.card {
	background-color: #fff;
	-moz-border-radius: 4px;
	-webkit-border-radius: 4px;
	border-radius: 4px;
	-moz-box-shadow: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);
	-webkit-box-shadow: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);
	box-shadow: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);
	color: rgba(0,0,0,.87);
	margin: 8px;
	min-width: 290px;
	overflow: hidden;
	position: relative;
}
.card::after {
	clear: both;
}
.card::after, .card::before {
	content: "";
	display: block;
}
.card__dark .action-icons {
	color: rgba(255,255,255,1);
}
.card__dark .border-top, .border-top {
	border-top: 1px solid rgba(0,0,0,0.12);
}
.card__dark .secondary-text, .card__dark .subhead, .media .optional-header .subhead {
	color: rgba(255,255,255,.7);
}
.card__dark, .media .primary-text, .media .secondary-text {
	color: #fff;
}
.card__dark--anthracite {
	background-color: rgba(41,49,51,1);
}
.card__dark--magenta {
	background-color: rgba(73, 64, 101,1);
}
.card__small {
	height: 146px;
}
.card__small .media {
	float: left;
	height: 100%;
	overflow: hidden;
	width: 88px;
}
.card__small .media img {
	height: 100%;
	left: 50%;
	position: absolute;
	-moz-transform: translate(-50%, 0);
	-ms-transform: translate(-50%, 0);
	-o-transform: translate(-50%, 0);
	-webkit-transform: translate(-50%, 0);
	transform: translate(-50%, 0);
	width: auto;
}
.card__small .media__right {
	float: right;
	height: 100%;
	overflow: hidden;
	width: 88px;
}
.card__small .media__right ~ .optional-header, .card__small .media__right ~ .primary-title, .card__small .media__right ~ .supporting-text, .card__small .media__right ~ .actions {
	margin-left: 0;
	margin-right: 88px;
}
.card__small .optional-header, .card__small .primary-title, .card__small .supporting-text, .card__small .actions {
	margin-left: 88px;
}
.card__small .primary-text, .card__small .secondary-text {
	width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.content {
	margin: 0 auto;
	max-width: 1440px;
}
.float-left {
	float: left!important;
}
.float-right {
	float: right!important;
}
.icon-color--yellow {
	color: #ffd12a;
}
.media {
	position: relative;
}
.media .action-icon {
	color: #fff;
	text-shadow: 0 2px 2px rgba(0,0,0,0.54);
}
.media .actions {
	background-image: linear-gradient(rgba(0,0,0,.38), rgba(0,0,0,0));
	color: #fff;
	position: absolute;
	width: 100%;
}
.media .optional-header {
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	box-sizing: border-box;
	color: #fff;
	display: block;
	float: left;
	width: 100%;
	z-index: 100;
}
.media .optional-header .primary-title {
	background-image: none;
	width: auto;
}
.media .primary-title {
	background-image: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.46));
	bottom: 0;
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	box-sizing: border-box;
	padding: 16px 16px 24px;
	position: absolute;
	width: 100%;
	z-index: 1;
}
[class*='media--'] {
	height: 0;
	overflow: hidden;
}
.media--1-1 {
	padding-bottom: 100%;
}
.media--16-9 {
	padding-bottom: 56.25%;
}
.media--16-9 > img, .media--3-2 > img, .media--4-3 > img {
	height: auto;
	left: 50%;
	top: 50%;
	-moz-transform: translate(-50%, -50%);
	-ms-transform: translate(-50%, -50%);
	-o-transform: translate(-50%, -50%);
	-webkit-transform: translate(-50%, -50%);
	transform: translate(-50%, -50%);
	width: 100%;
}
.media--16-9 img, .media--3-2 img, .media--4-3 img, .media--80x80 img, .media--1-1 img, .media--3-4 img, .media--2-3 img {
	position: absolute;
}
.media--2-3 {
	padding-bottom: 150%;
}
.media--3-2 {
	padding-bottom: 66.66%;
}
.media--3-4 {
	padding-bottom: 133.33%;
}
.media--4-3 {
	padding-bottom: 75%;
}
.media--80x80 {
	margin: 16px;
	padding-bottom: 80px;
	width: 80px;
}
.media--80x80 > img, .media--1-1 > img, .media--3-4 > img, .media--2-3 > img {
	height: 100%;
	left: 50%;
	-moz-transform: translate(-50%, 0);
	-ms-transform: translate(-50%, 0);
	-o-transform: translate(-50%, 0);
	-webkit-transform: translate(-50%, 0);
	transform: translate(-50%, 0);
	width: auto;
}
.optional-header {
	min-height: 40px;
	padding: 16px;
	position: relative;
}
.optional-header .action-icons {
	float: right;
	position: relative;
	right: -8px;
	top: 2px;
}
.optional-header .primary-title {
	bottom: auto;
	display: inline-block;
	padding: 0;
	position: absolute;
	top: 50%;
	-moz-transform: translate(0, -50%);
	-ms-transform: translate(0, -50%);
	-o-transform: translate(0, -50%);
	-webkit-transform: translate(0, -50%);
	transform: translate(0, -50%);
}
.primary-text {
	font-size: 24px;
}
.primary-text + .secondary-text, .secondary-text + .primary-text, .optional-header + .primary-text {
	margin-top: calc(24px/2/2); /* margin-top is 50% of the primary title font size. */
}
.primary-title {
	padding: 24px 16px 16px;
}
.primary-title + .supporting-text, .optional-header + .supporting-text {
	padding-top: 0;
}
.primary-title .optional-header {
	padding-left: 0;
	padding-right: 0;
}
.secondary-text .action-icon {
	font-size: inherit;
	margin: 0;
	padding: 0;
}
.subhead, .secondary-text {
	color: rgba(0,0,0,.54);
	font-size: 14px;
}
.supporting-text {
	font-size: 14px;
	line-height: 1.5;
	padding: 16px;
}
.thumbnail {
	-moz-border-radius: 50%;
	-webkit-border-radius: 50%;
	border-radius: 50%;
	float: left;
	height: 40px;
	position: relative;
	width: 40px;
}
.thumbnail img {
	background-color: #fff;
	-moz-border-radius: 50%;
	-webkit-border-radius: 50%;
	border-radius: 50%;
	position: absolute;
	top: 50%;
	-moz-transform: translate(0, -50%);
	-ms-transform: translate(0, -50%);
	-o-transform: translate(0, -50%);
	-webkit-transform: translate(0, -50%);
	transform: translate(0, -50%);
}
.thumbnail--24x24 img {
	height: 24px;
	width: 24px;
}
.thumbnail--28x28 {
	margin-right: 4px;
}
.thumbnail--28x28 img {
	height: 28px;
	width: 28px;
}
.thumbnail--32x32 {
	margin-right: 8px;
}
.thumbnail--32x32 img {
	height: 32px;
	width: 32px;
}
.thumbnail--36x36 {
	margin-right: 12px;
}
.thumbnail--36x36 img {
	height: 36px;
	width: 36px;
}
.thumbnail--40x40 {
	margin-right: 16px;
}
.thumbnail--40x40 img {
	height: 40px;
	width: 40px;
}
.title {
	font-size: 14px;
	font-weight: 500;
}
.title + .subhead {
	margin-top: calc(14px/2/2); /* margin-top is 50% of the title font size. */
}
.title, .primary-text {
	line-height: 1.2;
}

@media only screen and (min-width: 641px) {
[class*='col-']::after {
	clear: both;
}
[class*='col-']::after, [class*='col-']::before {
	clear: both;
}
[class*='col-'] {
	width: 49%;
}
}

@media only screen and (min-width: 992px) {
[class*='col-'] {
	width: 32%;
}
}

@media only screen and (min-width: 1200px) {
[class*='col-'] {
	width: 24%;
}
}
              
            
!

JS

              
                
              
            
!
999px

Console