codepens/box-model/dist/style.css

127 lines
2.4 KiB
CSS

body {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
/* scale the whole thing here */
font-size: min(2vmax, 2rem);
}
article {
background: repeating-linear-gradient(-45deg, hsl(0, 0%, 70%), hsl(0, 0%, 70%) 1px, white 1px, white 10px);
box-shadow: 0 2rem 5rem hsla(0, 0%, 0%, 0.25);
position: relative
}
article::before {
content: "Margin Box";
position: absolute;
top: 1ex;
left: 50%;
transform: translateX(-50%);
height: 3ex;
display: flex;
align-items: center;
justify-content: center;
font-size: .5em;
background: white;
padding: .25rem 1rem;
border-radius: 3rem;
}
article::after {
content: "Outline & Box Shadow";
position: absolute;
top: 6ex;
left: 0;
width: 100%;
height: 6ex;
display: flex;
align-items: center;
justify-content: center;
font-size: .5em;
color: white;
}
figure {
width: 25vmin;
height: 25vmin;
display: flex;
align-items: center;
justify-content: center;
margin: 6ex;
border: 3ex solid black;
outline: 3ex solid hsla(270, 50%, 40%, 0.8);
padding: 3ex;
background:
linear-gradient(white, white) content-box,
linear-gradient(hotpink, hotpink) padding-box;
position: relative
}
figure::after {
content: "Padding Box";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 6ex;
display: flex;
align-items: center;
justify-content: center;
font-size: .5em;
}
figure::before {
content: "Border Box";
color: white;
position: absolute;
top: 0;
left: 0;
transform: translateY(-100%);
width: 100%;
height: 6ex;
display: flex;
align-items: center;
justify-content: center;
font-size: .5em;
}
figure > .scrollbar {
background: hsla(0, 0%, 0%, 0.25);
position: absolute;
visibility: hidden
}
figure > .scrollbar.vertical {
width: 1ex;
height: 100%;
top: 0;
right: 0;
}
figure > .scrollbar.horizontal {
height: 1ex;
width: 100%;
bottom: 0;
left: 0;
}
figure[scrollbars="true"] .scrollbar {
visibility: visible;
}
figure[inline-scrollbars="true"] {
padding: 3ex 4ex 4ex 3ex;
}
form {
display: grid;
grid-template-columns: 1fr auto;
align-items: center;
justify-items: flex-end;
grid-gap: 1rem;
gap: 1rem;
margin-top: 3rem;
}