天天看點

html設定網格顔色,CSS網格調色闆

css

body {

background: #f9f9f9;

font-family: "Comfortaa", sans-serif;

}

aside.context {

text-align: center;

color: #333;

line-height: 1.7;

}

aside.context a {

text-decoration: none;

color: #333;

padding: 3px 0;

border-bottom: 1px dashed;

}

aside.context .explanation {

max-width: 700px;

margin: 6em auto 0;

}

footer {

text-align: center;

margin: 4em auto;

width: 100%;

}

footer a {

text-decoration: none;

display: inline-block;

width: 45px;

height: 45px;

border-radius: 50%;

background: transparent;

border: 1px dashed #333;

color: #333;

margin: 5px;

}

footer a:hover {

background: rgba(255, 255, 255, 0.1);

}

footer a .icons {

margin-top: 12px;

display: inline-block;

font-size: 20px;

}

.main-content {

margin: 4em auto 0;

max-width: 800px;

}

.palette-grid {

display: grid;

grid-template-columns: repeat(12, 1fr);

grid-template-rows: auto 300px auto 240px auto repeat(2, 200px);

grid-gap: 20px;

justify-content: center;

padding: 20px;

}

.palette {

background: #fff;

overflow: hidden;

position: relative;

top: 0;

padding: 0;

box-shadow: 0px 5px 20px rgba(128, 128, 128, 0.1);

display: flex;

align-items: stretch;

flex-wrap: wrap;

flex-flow: column;

transition: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);

}

.palette:hover {

top: -5px;

box-shadow: 0 8px 20px rgba(128, 128, 128, 0.12);

}

.palette--main-color {

grid-column: span 6;

}

.palette--secondary-color {

grid-column: span 4;

}

.palette--grays {

grid-column: span 3;

}

.palette-headers {

grid-column: span 12;

}

.palette__info {

color: #333;

position: relative;

flex: 0 0 auto;

font-size: 14px;

padding: 12px;

}

.palette__info__hexcode {

margin-top: 3px;

font-size: 12px;

color: gray;

}

.palette__colors {

flex: 1;

width: 100%;

position: relative;

display: flex;

align-items: stretch;

}

.palette__color {

background: var(--bg-color);

height: 100%;

flex: 1;

}

.palette__shades {

flex: 0;

display: flex;

flex-direction: column;

overflow: hidden;

}

.palette__shades__item {

flex: 1 1 auto;

background: var(--bg-color);

display: flex;

justify-content: center;

align-items: center;

opacity: 0;

position: relative;

left: 10px;

font-size: 80%;

}

.palette:hover .palette__shades {

flex: 0 0 33%;

transition: 0.2s ease;

}

.palette:hover .palette__shades__item {

opacity: 1;

left: 0;

}

.palette:hover .palette__shades__item:nth-child(1) {

transition: .2s ease .2s;

}

.palette:hover .palette__shades__item:nth-child(2) {

transition: .2s ease .4s;

}

.palette:hover .palette__shades__item:nth-child(3) {

transition: .2s ease .6s;

}

.font-white {

color: #fff;

}

@media screen and (max-width: 768px) {

.palette-grid {

grid-template-rows: auto 300px auto repeat(2, 240px) auto repeat(4, 200px);

}

.palette--secondary-color, .palette--grays {

grid-column: span 6;

}

}

.palette-headers {

margin: 60px 0 20px;

}

.palette-headers h1 {

margin: 10px 0;

text-transform: uppercase;

font: 700 32px 'Comfortaa', sans-serif;

letter-spacing: 4px;

}

.palette-headers h2 {

color: #999;

line-height: 1.5;

}