Skip to content

Commit

Permalink
fuck around with card borders and more
Browse files Browse the repository at this point in the history
  • Loading branch information
mdo committed Jan 18, 2016
1 parent 94e27cd commit 955e040
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 17 deletions.
83 changes: 83 additions & 0 deletions docs/components/card.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,89 @@ Add an optional header and/or footer within a card.
</div>
{% endexample %}

## Heading nav

- Custom card nav (full width)
- Tabs
- Pills
- Alignment:
- left
- center
- right

{% example html %}
<div class="card text-xs-center">
<div class="card-header">
<ul class="nav card-nav">
<li class="nav-item">
<a class="nav-link active" href="#">Active</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
</div>
<div class="card-block">
<h4 class="card-title">Special title treatment</h4>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
{% endexample %}



Or, use Bootstrap's nav pills or tabs to a card header. Be sure to always include a `.pull-*-*` utility class for proper alignment.

{% example html %}
<div class="card text-xs-center">
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs pull-xs-left">
<li class="nav-item">
<a class="nav-link active" href="#">Active</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
</div>
<div class="card-block">
<h4 class="card-title">Special title treatment</h4>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
{% endexample %}

{% example html %}
<div class="card text-xs-center">
<div class="card-header">
<ul class="nav nav-pills card-header-pills pull-xs-left">
<li class="nav-item">
<a class="nav-link active" href="#">Active</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
</div>
<div class="card-block">
<h4 class="card-title">Special title treatment</h4>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
{% endexample %}

## Image caps

Similar to headers and footers, cards include top and bottom image caps.
Expand Down
44 changes: 41 additions & 3 deletions scss/_card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
display: block;
margin-bottom: $card-spacer-y;
background-color: $card-bg;
border: $card-border-width solid $card-border-color;
// border: $card-border-width solid $card-border-color;

This comment has been minimized.

Copy link
@AntonTrollback

AntonTrollback Feb 9, 2016

@mdo, what's the reason for this? It's creating a bunch of overlapping issues in our code base. Card content with background colors.

This comment has been minimized.

Copy link
@jchristin

jchristin Mar 5, 2016

Same issue here. card-img-top overlap box-shadow.

@include border-radius($card-border-radius);
// Doesn't use mixin so that cards always have a "border"
box-shadow: inset 0 0 0 $card-border-width $card-border-color;
}

.card-block {
Expand Down Expand Up @@ -72,7 +74,9 @@
@include clearfix;
padding: $card-spacer-y $card-spacer-x;
background-color: $card-cap-bg;
border-bottom: $card-border-width solid $card-border-color;
// border-bottom: $card-border-width solid $card-border-color;
// Doesn't use mixin so that cards always have a "border"
box-shadow: inset 0 0 0 $card-border-width $card-border-color;

&:first-child {
@include border-radius($card-border-radius-inner $card-border-radius-inner 0 0);
Expand All @@ -83,14 +87,48 @@
@include clearfix;
padding: $card-spacer-y $card-spacer-x;
background-color: $card-cap-bg;
border-top: $card-border-width solid $card-border-color;
// border-top: $card-border-width solid $card-border-color;
// Doesn't use mixin so that cards always have a "border"
box-shadow: inset 0 0 0 $card-border-width $card-border-color;

&:last-child {
@include border-radius(0 0 $card-border-radius-inner $card-border-radius-inner);
}
}


//
// Header navs
//

.card-header-tabs {
margin-right: -($card-spacer-x / 2);
margin-bottom: -$card-spacer-y;
margin-left: -($card-spacer-x / 2);
border-bottom: 0;

.nav-item {
margin-bottom: 0;
}
}

.card-header-pills {
margin-right: -($card-spacer-x / 2);
margin-left: -($card-spacer-x / 2);
}

.card-nav {

.nav-item {
float: left;

+ .nav-item {
margin-left: $nav-item-margin;
}
}

}

//
// Background variations
//
Expand Down
13 changes: 0 additions & 13 deletions scss/_list-group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,8 @@

.list-group-flush {
.list-group-item {
border-width: $list-group-border-width 0;
border-radius: 0;
}

&:first-child {
.list-group-item:first-child {
border-top: 0;
}
}

&:last-child {
.list-group-item:last-child {
border-bottom: 0;
}
}
}


Expand Down
2 changes: 1 addition & 1 deletion scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ $card-spacer-x: 1.25rem !default;
$card-spacer-y: .75rem !default;
$card-border-width: 1px !default;
$card-border-radius: $border-radius !default;
$card-border-color: #e5e5e5 !default;
$card-border-color: rgba(0,0,0,.125) !default;
$card-border-radius-inner: $card-border-radius !default;
$card-cap-bg: #f5f5f5 !default;
$card-bg: #fff !default;
Expand Down

0 comments on commit 955e040

Please sign in to comment.