mirror of
https://github.com/twbs/bootstrap.git
synced 2024-11-29 11:24:18 +01:00
a60f8a6d79
before: https://pp.vk.me/c624325/v624325775/44408/FabMA25FDDs.jpg before(image-rendering: pixelated): https://pp.vk.me/c624325/v624325775/44416/Dzb6tO4Mmys.jpg after: https://pp.vk.me/c624325/v624325775/4440f/imd6KcYBgGI.jpg
227 lines
4.9 KiB
SCSS
227 lines
4.9 KiB
SCSS
// Embedded icons from Open Iconic.
|
|
// Released under MIT and copyright 2014 Waybury.
|
|
// http://useiconic.com/open
|
|
|
|
|
|
// Checkboxes and radios
|
|
//
|
|
// Base class takes care of all the key behavioral aspects.
|
|
|
|
.c-input {
|
|
position: relative;
|
|
display: inline;
|
|
padding-left: 1.5rem;
|
|
color: #555;
|
|
cursor: pointer;
|
|
|
|
> input {
|
|
position: absolute;
|
|
z-index: -1; // Put the input behind the label so it doesn't overlay text
|
|
opacity: 0;
|
|
|
|
&:focus ~ .c-indicator {
|
|
@include box-shadow(0 0 0 .075rem #fff, 0 0 0 .2rem #0074d9);
|
|
}
|
|
|
|
&:checked ~ .c-indicator {
|
|
color: #fff;
|
|
background-color: #0074d9;
|
|
@include box-shadow(none);
|
|
}
|
|
|
|
&:active ~ .c-indicator {
|
|
color: #fff;
|
|
background-color: #84c6ff;
|
|
@include box-shadow(none);
|
|
}
|
|
}
|
|
|
|
+ .c-input {
|
|
margin-left: 1rem;
|
|
}
|
|
}
|
|
|
|
// Custom indicator
|
|
//
|
|
// Generates a shadow element to create our makeshift checkbox/radio background.
|
|
|
|
.c-indicator {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
display: block;
|
|
width: 1rem;
|
|
height: 1rem;
|
|
font-size: 65%;
|
|
line-height: 1rem;
|
|
color: #eee;
|
|
text-align: center;
|
|
user-select: none;
|
|
background-color: #eee;
|
|
background-repeat: no-repeat;
|
|
background-position: center center;
|
|
background-size: 50% 50%;
|
|
@include box-shadow(inset 0 .125rem .125rem rgba(0,0,0,.1));
|
|
}
|
|
|
|
// Checkboxes
|
|
//
|
|
// Tweak just a few things for checkboxes.
|
|
|
|
.c-checkbox {
|
|
.c-indicator {
|
|
border-radius: .25rem;
|
|
}
|
|
|
|
input:checked ~ .c-indicator {
|
|
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA4IDgiPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik02LjQgMWwtLjcuNy0yLjggMi44LS44LS44LS43LS43TDAgNC40bC43LjcgMS41IDEuNS43LjcuNy0uNyAzLjUtMy41LjctLjdMNi40IDF6Ii8+PC9zdmc+);
|
|
}
|
|
|
|
input:indeterminate ~ .c-indicator {
|
|
background-color: #0074d9;
|
|
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA4IDgiPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik0wIDN2Mmg4VjNIMHoiLz48L3N2Zz4=);
|
|
@include box-shadow(none);
|
|
}
|
|
}
|
|
|
|
// Radios
|
|
//
|
|
// Tweak just a few things for radios.
|
|
|
|
.c-radio {
|
|
.c-indicator {
|
|
border-radius: 50%;
|
|
}
|
|
|
|
input:checked ~ .c-indicator {
|
|
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9Ii00IC00IDggOCI+PGNpcmNsZSByPSIzIiBmaWxsPSIjZmZmIi8+PC9zdmc+);
|
|
}
|
|
}
|
|
|
|
|
|
// Layout options
|
|
//
|
|
// By default radios and checkboxes are `inline-block` with no additional spacing
|
|
// set. Use these optional classes to tweak the layout.
|
|
|
|
.c-inputs-stacked {
|
|
.c-input {
|
|
display: inline;
|
|
|
|
&:after {
|
|
display: block;
|
|
margin-bottom: .25rem;
|
|
content: "";
|
|
}
|
|
|
|
+ .c-input {
|
|
margin-left: 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// Select
|
|
//
|
|
// Replaces the browser default select with a custom one, mostly pulled from
|
|
// http://primercss.io.
|
|
|
|
.c-select {
|
|
display: inline-block;
|
|
max-width: 100%;
|
|
padding: .375rem 1.75rem .375rem .75rem;
|
|
vertical-align: middle;
|
|
background: #fff url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0IDUiPjxwYXRoIGZpbGw9IiMzMzMiIGQ9Ik0yIDBMMCAyaDR6bTAgNUwwIDNoNHoiLz48L3N2Zz4=) no-repeat right .75rem center;
|
|
background-size: 8px 10px;
|
|
border: 1px solid $input-border;
|
|
|
|
// Have to include vendor prefixes as the `appearance` property isn't part of the CSS spec.
|
|
-webkit-appearance: none;
|
|
-moz-appearance: none;
|
|
appearance: none;
|
|
|
|
// IE9 hacks to hide the background-image and reduce padding
|
|
padding-right: .75rem \9;
|
|
background-image: none \9;
|
|
|
|
&:focus {
|
|
outline: none;
|
|
border-color: #51a7e8;
|
|
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.075), 0 0 5px rgba(81, 167, 232, 0.5);
|
|
}
|
|
|
|
// Hides the default caret in IE11
|
|
&::-ms-expand {
|
|
opacity: 0;
|
|
}
|
|
}
|
|
|
|
.c-select-sm {
|
|
padding-top: 3px;
|
|
padding-bottom: 3px;
|
|
font-size: 12px;
|
|
|
|
&:not([multiple]) {
|
|
height: 26px;
|
|
min-height: 26px;
|
|
}
|
|
}
|
|
|
|
|
|
// File
|
|
//
|
|
// Custom file input.
|
|
|
|
.file {
|
|
position: relative;
|
|
display: inline-block;
|
|
height: 2.5rem;
|
|
cursor: pointer;
|
|
}
|
|
.file input {
|
|
min-width: 14rem;
|
|
margin: 0;
|
|
filter: alpha(opacity=0);
|
|
opacity: 0;
|
|
}
|
|
.file-custom {
|
|
position: absolute;
|
|
top: 0;
|
|
right: 0;
|
|
left: 0;
|
|
z-index: 5;
|
|
height: 2.5rem;
|
|
padding: .5rem 1rem;
|
|
line-height: 1.5;
|
|
color: #555;
|
|
user-select: none;
|
|
background-color: #fff;
|
|
border: .075rem solid #ddd;
|
|
border-radius: .25rem;
|
|
box-shadow: inset 0 .2rem .4rem rgba(0,0,0,.05);
|
|
}
|
|
.file-custom:after {
|
|
content: "Choose file...";
|
|
}
|
|
.file-custom:before {
|
|
position: absolute;
|
|
top: -.075rem;
|
|
right: -.075rem;
|
|
bottom: -.075rem;
|
|
z-index: 6;
|
|
display: block;
|
|
height: 2.5rem;
|
|
padding: .5rem 1rem;
|
|
line-height: 1.5;
|
|
color: #555;
|
|
content: "Browse";
|
|
background-color: #eee;
|
|
border: .075rem solid #ddd;
|
|
border-radius: 0 .25rem .25rem 0;
|
|
}
|
|
|
|
// Focus state
|
|
.file input:focus ~ .file-custom {
|
|
box-shadow: 0 0 0 .075rem #fff, 0 0 0 .2rem #0074d9;
|
|
}
|