twbs--bootstrap/lib/patterns.less

685 lines
14 KiB
Plaintext

/* Patterns.less
* Repeatable UI elements outside the base styles provided from the scaffolding
* ---------------------------------------------------------------------------- */
// TOPBAR
// ------
// Topbar for Branding and Nav
.topbar {
height: 40px;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 10000;
overflow: visible;
// gradient is applied to it's own element because overflow visible is not honored by ie when filter is present
.fill {
background:#222;
#gradient > .vertical(#333, #222);
@shadow: 0 1px 3px rgba(0,0,0,.25), inset 0 -1px 0 rgba(0,0,0,.1);
.box-shadow(@shadow);
}
// Links get text shadow
a {
color: @grayLight;
text-shadow: 0 -1px 0 rgba(0,0,0,.25);
}
// Hover and active states
a:hover,
ul li.active a {
background-color: #333;
background-color: rgba(255,255,255,.05);
color: @white;
text-decoration: none;
}
// Website name
h3 {
position:relative;
a {
float: left;
display: block;
padding: 8px 20px 12px;
margin-left: -20px; // negative indent to left-align the text down the page
color: @white;
font-size: 20px;
font-weight: 200;
line-height: 1;
}
}
// Search Form
form {
float: left;
margin: 5px 0 0 0;
position: relative;
.opacity(100);
input {
background-color: #444;
background-color: rgba(255,255,255,.3);
#font > .sans-serif(13px, normal, 1);
width: 220px;
padding: 4px 9px;
color: #fff;
color: rgba(255,255,255,.75);
border: 1px solid #111;
.border-radius(4px);
@shadow: inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0px rgba(255,255,255,.25);
.box-shadow(@shadow);
.transition(none);
// Placeholder text gets special styles; can't be bundled together though for some reason
&:-moz-placeholder {
color: @grayLighter;
}
&::-webkit-input-placeholder {
color: @grayLighter;
}
// Hover states
&:hover {
background-color: @grayLight;
background-color: rgba(255,255,255,.5);
color: #fff;
}
// Focus states (we use .focused since IE8 and down doesn't support :focus)
&:focus,
&.focused {
outline: none;
background-color: #fff;
color: @grayDark;
text-shadow: 0 1px 0 #fff;
border: 0;
padding: 5px 10px;
.box-shadow(0 0 3px rgba(0,0,0,.15));
}
}
}
// Navigation
ul {
display: block;
float: left;
margin: 0 10px 0 0;
position: relative;
&.secondary-nav {
float: right;
margin-left: 10px;
margin-right: 0;
}
li {
display: block;
float: left;
font-size: 13px;
a {
display: block;
float: none;
padding: 10px 10px 11px;
line-height: 19px;
text-decoration: none;
&:hover {
color: #fff;
text-decoration: none;
}
}
&.active a {
background-color: #222;
background-color: rgba(0,0,0,.5);
}
}
// Dropdowns
&.primary-nav li ul {
left: 0;
}
&.secondary-nav li ul {
right: 0;
}
li.menu {
position: relative;
a.menu {
&:after {
width: 0px;
height: 0px;
display: inline-block;
content: "↓";
text-indent: -99999px;
vertical-align: top;
margin-top: 8px;
margin-left: 4px;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-top: 4px solid #fff;
.opacity(50);
}
}
&.open {
a.menu,
a:hover {
background-color: #444;
background-color: rgba(255,255,255,.1);
*background-color: #444; /* IE6-7 */
color: #fff;
}
ul {
display: block;
li {
a {
background-color: transparent;
font-weight: normal;
&:hover {
background-color: rgba(255,255,255,.1);
*background-color: #444; /* IE6-7 */
color: #fff;
}
}
&.active a {
background-color: rgba(255,255,255,.1);
font-weight: bold;
}
}
}
}
}
li ul {
background-color: #333;
float: left;
display: none;
position: absolute;
top: 40px;
min-width: 160px;
max-width: 220px;
_width: 160px;
margin-left: 0;
margin-right: 0;
padding: 0;
text-align: left;
border: 0;
zoom: 1;
.border-radius(0 0 5px 5px);
.box-shadow(0 1px 2px rgba(0,0,0,0.6));
li {
float: none;
clear: both;
display: block;
background: none;
font-size: 12px;
a {
display: block;
padding: 6px 15px;
clear: both;
font-weight: normal;
line-height: 19px;
color: #bbb;
&:hover {
background-color: #333;
background-color: rgba(255,255,255,.25);
color: #fff;
}
}
// Dividers (basically an hr)
&.divider {
height: 1px;
overflow: hidden;
background: #222;
background: rgba(0,0,0,.2);
border-bottom: 1px solid rgba(255,255,255,.1);
margin: 5px 0;
}
// Section separaters
span {
clear: both;
display: block;
background: rgba(0,0,0,.2);
padding: 6px 15px;
cursor: default;
color: @gray;
border-top: 1px solid rgba(0,0,0,.2);
}
}
}
}
}
// PAGE HEADERS
// ------------
.hero-unit {
background-color: #f5f5f5;
margin-top: 60px;
margin-bottom: 30px;
padding: 60px;
.border-radius(6px);
h1 {
margin-bottom: 0;
font-size: 60px;
line-height: 1;
letter-spacing: -1px;
}
p {
font-size: 18px;
font-weight: 200;
line-height: @baseline * 1.5;
}
}
footer {
margin-top: @baseline - 1;
padding-top: @baseline - 1;
border-top: 1px solid #eee;
}
// PAGE HEADERS
// ------------
.page-header {
margin-bottom: @baseline - 1;
border-bottom: 1px solid #ddd;
.box-shadow(0 1px 0 rgba(255,255,255,.5));
h1 {
margin-bottom: (@baseline / 2) - 1px;
}
}
// ERROR STYLES
// ------------
// Setup a mixin to colorize different alerts
.alertTheme(@primaryColor, @secondaryColor) {
#gradient > .vertical(@primaryColor, @secondaryColor);
text-shadow: 0 -1px 0 rgba(0,0,0,.25);
border-color: darken(@secondaryColor, 10%) darken(@secondaryColor, 10%) darken(@secondaryColor, 15%);
border-color: rgba(0,0,0,.05) rgba(0,0,0,.075) rgba(0,0,0,.125);
}
// Base alert styles
.alert {
.alertTheme(#fceec1, #eedc94);
margin-bottom: @baseline;
padding: 7px 14px;
color: @grayDark;
text-shadow: 0 1px 0 rgba(255,255,255,.5);
border-width: 1px;
border-style: solid;
.border-radius(4px);
.box-shadow(inset 0 1px 0 rgba(255,255,255,.25));
// Remove extra margin from content
h5 {
line-height: @baseline;
}
p {
margin-bottom: 0;
}
div {
margin-top: 5px;
margin-bottom: 2px;
line-height: 28px;
}
// Provide actions with buttons
.btn {
.box-shadow(0 1px 0 rgba(255,255,255,.25));
}
}
// Alternate alerts
.alert-error,
.alert-success,
.alert-info,
.alert-error h5,
.alert-success h5,
.alert-info h5 {
color: #fff;
text-shadow: 0 -1px 0 rgba(0,0,0,.3);
}
.alert-error { .alertTheme(#f56a66, #d6463e); }
.alert-success { .alertTheme(#62c462, #57a957); }
.alert-info { .alertTheme(#6bd0ee, #36b3d9); }
// Close action
.close {
float: right;
margin-top: -2px;
color: @black;
font-size: 20px;
font-weight: bold;
text-shadow: 0 1px 0 rgba(255,255,255,1);
.opacity(20);
&:hover {
color: @black;
text-decoration: none;
.opacity(40);
}
}
// Block-level alerts
.alert-block {
background-image: none;
background-color: lighten(#fceec1, 5%);
padding: 14px;
border-color: #fceec1;
.box-shadow(none);
p {
margin-right: 30px;
}
.alert-actions {
margin-top: 5px;
}
}
.alert-block.error {
background-color: lighten(#f56a66, 25%);
border-color: lighten(#f56a66, 20%);
}
.alert-block.success {
background-color: lighten(#62c462, 30%);
border-color: lighten(#62c462, 25%);
}
.alert-block.info {
background-color: lighten(#6bd0ee, 25%);
border-color: lighten(#6bd0ee, 20%);
}
// NAVIGATION
// ----------
// Common tab and pill styles
.tabs,
.pills {
margin: 0 0 20px;
padding: 0;
.clearfix();
li {
display: inline;
a {
float: left;
width: auto;
}
}
}
// Basic Tabs
.tabs {
width: 100%;
border-bottom: 1px solid @grayLight;
li {
a {
margin-bottom: -1px;
margin-right: 2px;
padding: 0 15px;
line-height: (@baseline * 2) - 1;
.border-radius(3px 3px 0 0);
&:hover {
background-color: @grayLighter;
border-bottom: 1px solid @grayLight;
}
}
&.active a {
background-color: #fff;
padding: 0 14px;
border: 1px solid #ccc;
border-bottom: 0;
color: @gray;
}
}
}
// Basic pill nav
.pills {
li {
a {
margin: 5px 3px 5px 0;
padding: 0 15px;
text-shadow: 0 1px 1px #fff;
line-height: 30px;
.border-radius(15px);
&:hover {
background: @linkColorHover;
color: #fff;
text-decoration: none;
text-shadow: 0 1px 1px rgba(0,0,0,.25);
}
}
&.active a {
background: @linkColor;
color: #fff;
text-shadow: 0 1px 1px rgba(0,0,0,.25);
}
}
}
// PAGINATION
// ----------
.pagination {
height: @baseline * 2;
margin: @baseline 0;
ul {
float: left;
margin: 0;
border: 1px solid #ddd;
border: 1px solid rgba(0,0,0,.15);
.border-radius(3px);
.box-shadow(0 1px 2px rgba(0,0,0,.05));
li {
display: inline;
a {
float: left;
padding: 0 14px;
line-height: (@baseline * 2) - 2;
border-right: 1px solid;
border-right-color: #ddd;
border-right-color: rgba(0,0,0,.15);
*border-right-color: #ddd; /* IE6-7 */
text-decoration: none;
}
a:hover,
&.active a {
background-color: lighten(@blue, 45%);
}
&.disabled a,
&.disabled a:hover {
background-color: none;
color: @grayLight;
}
&.next a {
border: 0;
}
}
}
}
// WELLS
// -----
.well {
background-color: #f5f5f5;
margin-bottom: 20px;
padding: 19px;
min-height: 20px;
border: 1px solid #eee;
border: 1px solid rgba(0,0,0,.05);
.border-radius(4px);
.box-shadow(inset 0 1px 1px rgba(0,0,0,.05));
}
// MODALS
// ------
.modal-backdrop {
background-color: rgba(0,0,0,.5);
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1000;
}
.modal {
position: fixed;
top: 50%;
left: 50%;
z-index: 2000;
width: 560px;
margin: -280px 0 0 -250px;
background-color: @white;
border: 1px solid #999;
border: 1px solid rgba(0,0,0,.3);
*border: 1px solid #999; /* IE6-7 */
.border-radius(6px);
.box-shadow(0 3px 7px rgba(0,0,0,0.3));
.background-clip(padding-box);
.modal-header {
border-bottom: 1px solid #eee;
padding: 5px 20px;
.close {
position: absolute;
right: 10px;
top: 10px;
color: #999;
line-height:10px;
font-size: 18px;
}
}
.modal-body {
padding: 20px;
}
.modal-footer {
background-color: #f5f5f5;
padding: 14px 20px 15px;
border-top: 1px solid #ddd;
.border-radius(0 0 6px 6px);
.box-shadow(inset 0 1px 0 #fff);
.clearfix();
.btn {
float: right;
margin-left: 10px;
}
}
}
// POPOVER ARROWS
// --------------
#popoverArrow {
.above(@arrowWidth: 5px) {
bottom: 0;
left: 50%;
margin-left: -@arrowWidth;
border-left: @arrowWidth solid transparent;
border-right: @arrowWidth solid transparent;
border-top: @arrowWidth solid #000;
}
.left(@arrowWidth: 5px) {
top: 50%;
right: 0;
margin-top: -@arrowWidth;
border-top: @arrowWidth solid transparent;
border-bottom: @arrowWidth solid transparent;
border-left: @arrowWidth solid #000;
}
.below(@arrowWidth: 5px) {
top: 0;
left: 50%;
margin-left: -@arrowWidth;
border-left: @arrowWidth solid transparent;
border-right: @arrowWidth solid transparent;
border-bottom: @arrowWidth solid #000;
}
.right(@arrowWidth: 5px) {
top: 50%;
left: 0;
margin-top: -@arrowWidth;
border-top: @arrowWidth solid transparent;
border-bottom: @arrowWidth solid transparent;
border-right: @arrowWidth solid #000;
}
}
// TWIPSY
// ------
.twipsy {
display: block;
position: absolute;
visibility: visible;
padding: 5px;
font-size: 11px;
z-index: 1000;
.opacity(80);
&.above .twipsy-arrow { #popoverArrow > .above(); }
&.left .twipsy-arrow { #popoverArrow > .left(); }
&.below .twipsy-arrow { #popoverArrow > .below(); }
&.right .twipsy-arrow { #popoverArrow > .right(); }
.twipsy-inner {
padding: 3px 8px;
background-color: #000;
color: white;
text-align: center;
max-width: 200px;
text-decoration: none;
.border-radius(4px);
}
.twipsy-arrow {
position: absolute;
width: 0;
height: 0;
}
}
// POPOVERS
// --------
.popover {
position: absolute;
top: 0;
left: 0;
z-index: 1000;
padding: 5px;
display: none;
&.above .arrow { #popoverArrow > .above(); }
&.right .arrow { #popoverArrow > .right(); }
&.below .arrow { #popoverArrow > .below(); }
&.left .arrow { #popoverArrow > .left(); }
.arrow {
position: absolute;
width: 0;
height: 0;
}
.inner {
background-color: #333;
background-color: rgba(0,0,0,.8);
*background-color: #333; /* IE 6-7 */
padding: 3px;
overflow: hidden;
width: 280px;
.border-radius(6px);
.box-shadow(0 3px 7px rgba(0,0,0,0.3));
}
.title {
background-color: #f5f5f5;
padding: 9px 15px;
line-height: 1;
.border-radius(3px 3px 0 0);
border-bottom:1px solid #eee;
}
.content {
background-color: @white;
padding: 14px;
.border-radius(0 0 3px 3px);
.background-clip(padding-box);
p, ul, ol {
margin-bottom: 0;
}
}
}