提交 bd5af591 编写于 作者: C Catouse

* ajust code format.

上级 93d460a6
...@@ -92,6 +92,7 @@ base_url: "./" ...@@ -92,6 +92,7 @@ base_url: "./"
<h3>2.3 设计准则</h3> <h3>2.3 设计准则</h3>
<ul> <ul>
<li>尽量减少界面中线条的出现,避免造成界面显得复杂。应该尽可能考虑使用背景及留白来区分内容的不同部分。</li> <li>尽量减少界面中线条的出现,避免造成界面显得复杂。应该尽可能考虑使用背景及留白来区分内容的不同部分。</li>
<li>为实现响应式设计,应全部采用流式布局,针对控件及元素的尺寸应尽可能采用百分比来约束,除非必要不要使用像素作为长度单位。</li>
</ul> </ul>
<h3>2.4 开发约定</h3> <h3>2.4 开发约定</h3>
<ul> <ul>
......
...@@ -2,16 +2,18 @@ ...@@ -2,16 +2,18 @@
// Scaffolding // Scaffolding
// ================================================== // ==================================================
*, *:before, *:after { .box-sizing(border-box); } *, *:before, *:after{ .box-sizing(border-box); }
// Body reset // Body reset
html { html
{
font-size: 62.5%; font-size: 62.5%;
-webkit-tap-highlight-color: rgba(0,0,0,0); -webkit-tap-highlight-color: rgba(0,0,0,0);
} }
body { body
{
font-family: @font-family-base; font-family: @font-family-base;
font-size: @font-size-base; font-size: @font-size-base;
line-height: @line-height-base; line-height: @line-height-base;
...@@ -23,7 +25,8 @@ body { ...@@ -23,7 +25,8 @@ body {
input, input,
button, button,
select, select,
textarea { textarea
{
font-family: inherit; font-family: inherit;
font-size: inherit; font-size: inherit;
line-height: inherit; line-height: inherit;
...@@ -32,17 +35,20 @@ textarea { ...@@ -32,17 +35,20 @@ textarea {
// Links // Links
a { a
{
color: @link-color; color: @link-color;
text-decoration: none; text-decoration: none;
&:hover, &:hover,
&:focus { &:focus
{
color: @link-hover-color; color: @link-hover-color;
text-decoration: underline; text-decoration: underline;
} }
&:focus { &:focus
{
.tab-focus(); .tab-focus();
} }
} }
...@@ -55,7 +61,8 @@ audio, ...@@ -55,7 +61,8 @@ audio,
canvas, canvas,
img, img,
svg, svg,
video { video
{
vertical-align: middle; vertical-align: middle;
max-width: 100%; max-width: 100%;
} }
...@@ -63,7 +70,8 @@ video { ...@@ -63,7 +70,8 @@ video {
// Only display content to screen readers // Only display content to screen readers
// //
// See: http://a11yproject.com/posts/how-to-hide-content/ // See: http://a11yproject.com/posts/how-to-hide-content/
.sr-only { .sr-only
{
position: absolute; position: absolute;
width: 1px; width: 1px;
height: 1px; height: 1px;
...@@ -78,17 +86,20 @@ video { ...@@ -78,17 +86,20 @@ video {
// Remove text-shadow in selection highlight: h5bp.com/i // Remove text-shadow in selection highlight: h5bp.com/i
// These selection rule sets have to be separate. // These selection rule sets have to be separate.
// Customize the background color to match your design. // Customize the background color to match your design.
::-moz-selection { ::-moz-selection
{
background: #b3d4fc; background: #b3d4fc;
text-shadow: none; text-shadow: none;
} }
::selection { ::selection
{
background: #b3d4fc; background: #b3d4fc;
text-shadow: none; text-shadow: none;
} }
// Remove default fieldset styles. // Remove default fieldset styles.
fieldset { fieldset
{
border: 0; border: 0;
margin: 0; margin: 0;
padding: 0; padding: 0;
...@@ -96,6 +107,7 @@ fieldset { ...@@ -96,6 +107,7 @@ fieldset {
// Allow only vertical resizing of textareas. // Allow only vertical resizing of textareas.
textarea { textarea
{
resize: vertical; resize: vertical;
} }
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
// -------------------------------------------------- // --------------------------------------------------
// Button sizes // Button sizes
.button-size(@padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) { .button-size(@padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius)
{
padding: @padding-vertical @padding-horizontal; padding: @padding-vertical @padding-horizontal;
font-size: @font-size; font-size: @font-size;
line-height: @line-height; line-height: @line-height;
...@@ -19,7 +20,8 @@ ...@@ -19,7 +20,8 @@
// -------------------------------------------------- // --------------------------------------------------
// Core styles // Core styles
.btn { .btn
{
display: inline-block; display: inline-block;
margin-bottom: 0; // For input.btn margin-bottom: 0; // For input.btn
font-weight: @btn-font-weight; font-weight: @btn-font-weight;
...@@ -32,18 +34,21 @@ ...@@ -32,18 +34,21 @@
.button-size(@padding-base-vertical; @padding-base-horizontal; @font-size-base; @line-height-base; @border-radius-base); .button-size(@padding-base-vertical; @padding-base-horizontal; @font-size-base; @line-height-base; @border-radius-base);
.user-select(none); .user-select(none);
&:focus { &:focus
{
.tab-focus(); .tab-focus();
} }
&:hover, &:hover,
&:focus { &:focus
{
color: @btn-default-color; color: @btn-default-color;
text-decoration: none; text-decoration: none;
} }
&:active, &:active,
&.active { &.active
{
outline: 0; outline: 0;
background-image: none; background-image: none;
.box-shadow(inset 0 3px 5px rgba(0,0,0,.125)); .box-shadow(inset 0 3px 5px rgba(0,0,0,.125));
...@@ -51,7 +56,8 @@ ...@@ -51,7 +56,8 @@
&.disabled, &.disabled,
&[disabled], &[disabled],
fieldset[disabled] & { fieldset[disabled] &
{
cursor: not-allowed; cursor: not-allowed;
pointer-events: none; // Future-proof disabling of clicks pointer-events: none; // Future-proof disabling of clicks
.opacity(.65); .opacity(.65);
...@@ -64,26 +70,32 @@ ...@@ -64,26 +70,32 @@
// Alternate buttons // Alternate buttons
// -------------------------------------------------- // --------------------------------------------------
.btn-default { .btn-default
{
.button-variant(@btn-default-color; @btn-default-bg; @btn-default-border); .button-variant(@btn-default-color; @btn-default-bg; @btn-default-border);
} }
.btn-primary { .btn-primary
{
.button-variant(@btn-primary-color; @btn-primary-bg; @btn-primary-border); .button-variant(@btn-primary-color; @btn-primary-bg; @btn-primary-border);
} }
// Warning appears as orange // Warning appears as orange
.btn-warning { .btn-warning
{
.button-variant(@btn-warning-color; @btn-warning-bg; @btn-warning-border); .button-variant(@btn-warning-color; @btn-warning-bg; @btn-warning-border);
} }
// Danger and error appear as red // Danger and error appear as red
.btn-danger { .btn-danger
{
.button-variant(@btn-danger-color; @btn-danger-bg; @btn-danger-border); .button-variant(@btn-danger-color; @btn-danger-bg; @btn-danger-border);
} }
// Success appears as green // Success appears as green
.btn-success { .btn-success
{
.button-variant(@btn-success-color; @btn-success-bg; @btn-success-border); .button-variant(@btn-success-color; @btn-success-bg; @btn-success-border);
} }
// Info appears as blue-green // Info appears as blue-green
.btn-info { .btn-info
{
.button-variant(@btn-info-color; @btn-info-bg; @btn-info-border); .button-variant(@btn-info-color; @btn-info-bg; @btn-info-border);
} }
...@@ -92,7 +104,8 @@ ...@@ -92,7 +104,8 @@
// ------------------------- // -------------------------
// Make a button look and behave like a link // Make a button look and behave like a link
.btn-link { .btn-link
{
color: @link-color; color: @link-color;
font-weight: normal; font-weight: normal;
cursor: pointer; cursor: pointer;
...@@ -101,26 +114,31 @@ ...@@ -101,26 +114,31 @@
&, &,
&:active, &:active,
&[disabled], &[disabled],
fieldset[disabled] & { fieldset[disabled] &
{
background-color: transparent; background-color: transparent;
.box-shadow(none); .box-shadow(none);
} }
&, &,
&:hover, &:hover,
&:focus, &:focus,
&:active { &:active
{
border-color: transparent; border-color: transparent;
} }
&:hover, &:hover,
&:focus { &:focus
{
color: @link-hover-color; color: @link-hover-color;
text-decoration: underline; text-decoration: underline;
background-color: transparent; background-color: transparent;
} }
&[disabled], &[disabled],
fieldset[disabled] & { fieldset[disabled] &
{
&:hover, &:hover,
&:focus { &:focus
{
color: @btn-link-disabled-color; color: @btn-link-disabled-color;
text-decoration: none; text-decoration: none;
} }
...@@ -131,16 +149,19 @@ ...@@ -131,16 +149,19 @@
// Button Sizes // Button Sizes
// -------------------------------------------------- // --------------------------------------------------
.btn-lg { .btn-lg
{
// line-height: ensure even-numbered height of button next to large input // line-height: ensure even-numbered height of button next to large input
.button-size(@padding-large-vertical; @padding-large-horizontal; @font-size-large; @line-height-large; @border-radius-large); .button-size(@padding-large-vertical; @padding-large-horizontal; @font-size-large; @line-height-large; @border-radius-large);
} }
.btn-sm, .btn-sm,
.btn-xs { .btn-xs
{
// line-height: ensure proper height of button next to small input // line-height: ensure proper height of button next to small input
.button-size(@padding-small-vertical; @padding-small-horizontal; @font-size-small; @line-height-small; @border-radius-small); .button-size(@padding-small-vertical; @padding-small-horizontal; @font-size-small; @line-height-small; @border-radius-small);
} }
.btn-xs { .btn-xs
{
padding: 1px 5px; padding: 1px 5px;
} }
...@@ -148,7 +169,8 @@ ...@@ -148,7 +169,8 @@
// Block button // Block button
// -------------------------------------------------- // --------------------------------------------------
.btn-block { .btn-block
{
display: block; display: block;
width: 100%; width: 100%;
padding-left: 0; padding-left: 0;
...@@ -156,15 +178,18 @@ ...@@ -156,15 +178,18 @@
} }
// Vertically space out multiple block buttons // Vertically space out multiple block buttons
.btn-block + .btn-block { .btn-block + .btn-block
{
margin-top: 5px; margin-top: 5px;
} }
// Specificity overrides // Specificity overrides
input[type="submit"], input[type="submit"],
input[type="reset"], input[type="reset"],
input[type="button"] { input[type="button"]
&.btn-block { {
&.btn-block
{
width: 100%; width: 100%;
} }
} }
...@@ -179,28 +204,35 @@ input[type="button"] { ...@@ -179,28 +204,35 @@ input[type="button"] {
// Button carets // Button carets
// Match the button text color to the arrow/caret for indicating dropdown-ness. // Match the button text color to the arrow/caret for indicating dropdown-ness.
.caret { .caret
.btn-default & { {
.btn-default &
{
border-top-color: @btn-default-color; border-top-color: @btn-default-color;
} }
.btn-primary &, .btn-primary &,
.btn-success &, .btn-success &,
.btn-warning &, .btn-warning &,
.btn-danger &, .btn-danger &,
.btn-info & { .btn-info &
{
border-top-color: #fff; border-top-color: #fff;
} }
} }
.dropup { .dropup
& .btn-default .caret { {
& .btn-default .caret
{
border-bottom-color: @btn-default-color; border-bottom-color: @btn-default-color;
} }
.btn-primary, .btn-primary,
.btn-success, .btn-success,
.btn-warning, .btn-warning,
.btn-danger, .btn-danger,
.btn-info { .btn-info
.caret { {
.caret
{
border-bottom-color: #fff; border-bottom-color: #fff;
} }
} }
...@@ -208,21 +240,25 @@ input[type="button"] { ...@@ -208,21 +240,25 @@ input[type="button"] {
// Make the div behave like a button // Make the div behave like a button
.btn-group, .btn-group,
.btn-group-vertical { .btn-group-vertical
{
position: relative; position: relative;
display: inline-block; display: inline-block;
vertical-align: middle; // match .btn alignment given font-size hack above vertical-align: middle; // match .btn alignment given font-size hack above
> .btn { > .btn
{
position: relative; position: relative;
float: left; float: left;
// Bring the "active" button to the front // Bring the "active" button to the front
&:hover, &:hover,
&:focus, &:focus,
&:active, &:active,
&.active { &.active
{
z-index: 2; z-index: 2;
} }
&:focus { &:focus
{
// Remove focus outline when dropdown JS adds it after closing the menu // Remove focus outline when dropdown JS adds it after closing the menu
outline: none; outline: none;
} }
...@@ -230,69 +266,85 @@ input[type="button"] { ...@@ -230,69 +266,85 @@ input[type="button"] {
} }
// Prevent double borders when buttons are next to each other // Prevent double borders when buttons are next to each other
.btn-group { .btn-group
{
.btn + .btn, .btn + .btn,
.btn + .btn-group, .btn + .btn-group,
.btn-group + .btn, .btn-group + .btn,
.btn-group + .btn-group { .btn-group + .btn-group
{
margin-left: -1px; margin-left: -1px;
} }
} }
// Optional: Group multiple button groups together for a toolbar // Optional: Group multiple button groups together for a toolbar
.btn-toolbar { .btn-toolbar
{
.clearfix(); .clearfix();
.btn-group { .btn-group
{
float: left; float: left;
} }
// Space out series of button groups // Space out series of button groups
> .btn, > .btn,
> .btn-group { > .btn-group
{
+ .btn, + .btn,
+ .btn-group { + .btn-group
{
margin-left: 5px; margin-left: 5px;
} }
} }
} }
.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) { .btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle)
{
border-radius: 0; border-radius: 0;
} }
// Set corners individual because sometimes a single button can be in a .btn-group and we need :first-child and :last-child to both match // Set corners individual because sometimes a single button can be in a .btn-group and we need :first-child and :last-child to both match
.btn-group > .btn:first-child { .btn-group > .btn:first-child
{
margin-left: 0; margin-left: 0;
&:not(:last-child):not(.dropdown-toggle) { &:not(:last-child):not(.dropdown-toggle)
{
.border-right-radius(0); .border-right-radius(0);
} }
} }
// Need .dropdown-toggle since :last-child doesn't apply given a .dropdown-menu immediately after it // Need .dropdown-toggle since :last-child doesn't apply given a .dropdown-menu immediately after it
.btn-group > .btn:last-child:not(:first-child), .btn-group > .btn:last-child:not(:first-child),
.btn-group > .dropdown-toggle:not(:first-child) { .btn-group > .dropdown-toggle:not(:first-child)
{
.border-left-radius(0); .border-left-radius(0);
} }
// Custom edits for including btn-groups within btn-groups (useful for including dropdown buttons within a btn-group) // Custom edits for including btn-groups within btn-groups (useful for including dropdown buttons within a btn-group)
.btn-group > .btn-group { .btn-group > .btn-group
{
float: left; float: left;
} }
.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn { .btn-group > .btn-group:not(:first-child):not(:last-child) > .btn
{
border-radius: 0; border-radius: 0;
} }
.btn-group > .btn-group:first-child { .btn-group > .btn-group:first-child
{
> .btn:last-child, > .btn:last-child,
> .dropdown-toggle { > .dropdown-toggle
{
.border-right-radius(0); .border-right-radius(0);
} }
} }
.btn-group > .btn-group:last-child > .btn:first-child { .btn-group > .btn-group:last-child > .btn:first-child
{
.border-left-radius(0); .border-left-radius(0);
} }
// On active and open, don't show outline // On active and open, don't show outline
.btn-group .dropdown-toggle:active, .btn-group .dropdown-toggle:active,
.btn-group.open .dropdown-toggle { .btn-group.open .dropdown-toggle
{
outline: 0; outline: 0;
} }
...@@ -301,42 +353,51 @@ input[type="button"] { ...@@ -301,42 +353,51 @@ input[type="button"] {
// //
// Remix the default button sizing classes into new ones for easier manipulation. // Remix the default button sizing classes into new ones for easier manipulation.
.btn-group-xs > .btn { .btn-xs(); } .btn-group-xs > .btn
.btn-group-sm > .btn { .btn-sm(); } { .btn-xs(); }
.btn-group-lg > .btn { .btn-lg(); } .btn-group-sm > .btn
{ .btn-sm(); }
.btn-group-lg > .btn
{ .btn-lg(); }
// Split button dropdowns // Split button dropdowns
// ---------------------- // ----------------------
// Give the line between buttons some depth // Give the line between buttons some depth
.btn-group > .btn + .dropdown-toggle { .btn-group > .btn + .dropdown-toggle
{
padding-left: 8px; padding-left: 8px;
padding-right: 8px; padding-right: 8px;
} }
.btn-group > .btn-lg + .dropdown-toggle { .btn-group > .btn-lg + .dropdown-toggle
{
padding-left: 12px; padding-left: 12px;
padding-right: 12px; padding-right: 12px;
} }
// The clickable button for toggling the menu // The clickable button for toggling the menu
// Remove the gradient and set the same inset shadow as the :active state // Remove the gradient and set the same inset shadow as the :active state
.btn-group.open .dropdown-toggle { .btn-group.open .dropdown-toggle
{
.box-shadow(inset 0 3px 5px rgba(0,0,0,.125)); .box-shadow(inset 0 3px 5px rgba(0,0,0,.125));
} }
// Reposition the caret // Reposition the caret
.btn .caret { .btn .caret
{
margin-left: 0; margin-left: 0;
} }
// Carets in other button sizes // Carets in other button sizes
.btn-lg .caret { .btn-lg .caret
{
border-width: @caret-width-large @caret-width-large 0; border-width: @caret-width-large @caret-width-large 0;
border-bottom-width: 0; border-bottom-width: 0;
} }
// Upside down carets for .dropup // Upside down carets for .dropup
.dropup .btn-lg .caret { .dropup .btn-lg .caret
{
border-width: 0 @caret-width-large @caret-width-large; border-width: 0 @caret-width-large @caret-width-large;
} }
...@@ -344,9 +405,11 @@ input[type="button"] { ...@@ -344,9 +405,11 @@ input[type="button"] {
// Vertical button groups // Vertical button groups
// ---------------------- // ----------------------
.btn-group-vertical { .btn-group-vertical
{
> .btn, > .btn,
> .btn-group { > .btn-group
{
display: block; display: block;
float: none; float: none;
width: 100%; width: 100%;
...@@ -354,9 +417,11 @@ input[type="button"] { ...@@ -354,9 +417,11 @@ input[type="button"] {
} }
// Clear floats so dropdown menus can be properly placed // Clear floats so dropdown menus can be properly placed
> .btn-group { > .btn-group
{
.clearfix(); .clearfix();
> .btn { > .btn
{
float: none; float: none;
} }
} }
...@@ -364,35 +429,44 @@ input[type="button"] { ...@@ -364,35 +429,44 @@ input[type="button"] {
> .btn + .btn, > .btn + .btn,
> .btn + .btn-group, > .btn + .btn-group,
> .btn-group + .btn, > .btn-group + .btn,
> .btn-group + .btn-group { > .btn-group + .btn-group
{
margin-top: -1px; margin-top: -1px;
margin-left: 0; margin-left: 0;
} }
} }
.btn-group-vertical > .btn { .btn-group-vertical > .btn
&:not(:first-child):not(:last-child) { {
&:not(:first-child):not(:last-child)
{
border-radius: 0; border-radius: 0;
} }
&:first-child:not(:last-child) { &:first-child:not(:last-child)
{
border-top-right-radius: @border-radius-base; border-top-right-radius: @border-radius-base;
.border-bottom-radius(0); .border-bottom-radius(0);
} }
&:last-child:not(:first-child) { &:last-child:not(:first-child)
{
border-bottom-left-radius: @border-radius-base; border-bottom-left-radius: @border-radius-base;
.border-top-radius(0); .border-top-radius(0);
} }
} }
.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn { .btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn
{
border-radius: 0; border-radius: 0;
} }
.btn-group-vertical > .btn-group:first-child { .btn-group-vertical > .btn-group:first-child
{
> .btn:last-child, > .btn:last-child,
> .dropdown-toggle { > .dropdown-toggle
{
.border-bottom-radius(0); .border-bottom-radius(0);
} }
} }
.btn-group-vertical > .btn-group:last-child > .btn:first-child { .btn-group-vertical > .btn-group:last-child > .btn:first-child
{
.border-top-radius(0); .border-top-radius(0);
} }
...@@ -401,12 +475,14 @@ input[type="button"] { ...@@ -401,12 +475,14 @@ input[type="button"] {
// Justified button groups // Justified button groups
// ---------------------- // ----------------------
.btn-group-justified { .btn-group-justified
{
display: table; display: table;
width: 100%; width: 100%;
table-layout: fixed; table-layout: fixed;
border-collapse: separate; border-collapse: separate;
.btn { .btn
{
float: none; float: none;
display: table-cell; display: table-cell;
width: 1%; width: 1%;
...@@ -416,6 +492,7 @@ input[type="button"] { ...@@ -416,6 +492,7 @@ input[type="button"] {
// Checkbox and radio options // Checkbox and radio options
[data-toggle="buttons"] > .btn > input[type="radio"], [data-toggle="buttons"] > .btn > input[type="radio"],
[data-toggle="buttons"] > .btn > input[type="checkbox"] { [data-toggle="buttons"] > .btn > input[type="checkbox"]
{
display: none; display: none;
} }
...@@ -2,19 +2,22 @@ ...@@ -2,19 +2,22 @@
// ------------------------ // ------------------------
// Responsive images (ensure images don't scale beyond their parents) // Responsive images (ensure images don't scale beyond their parents)
.img-responsive { .img-responsive
{
.img-responsive(); .img-responsive();
} }
// Rounded corners // Rounded corners
.img-rounded { .img-rounded
{
border-radius: @border-radius-large; border-radius: @border-radius-large;
} }
// Image thumbnails // Image thumbnails
// //
// Heads up! This is mixin-ed into thumbnails.less for `.thumbnail`. // Heads up! This is mixin-ed into thumbnails.less for `.thumbnail`.
.img-thumbnail { .img-thumbnail
{
padding: @thumbnail-padding; padding: @thumbnail-padding;
line-height: @line-height-base; line-height: @line-height-base;
background-color: @thumbnail-bg; background-color: @thumbnail-bg;
...@@ -27,6 +30,7 @@ ...@@ -27,6 +30,7 @@
} }
// Perfect circle // Perfect circle
.img-circle { .img-circle
{
border-radius: 50%; // set radius in percents border-radius: 50%; // set radius in percents
} }
.form-control { .form-control
{
display: block; display: block;
width: 100%; width: 100%;
height: @input-height-base; // Make inputs at least the height of their button counterpart (base line-height + padding + border) height: @input-height-base; // Make inputs at least the height of their button counterpart (base line-height + padding + border)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册