(I make websites.)
overflow
CSS
.box {
border:0.1em solid white;
width: 4em;
padding:0.3em;
}
HTML
CSS IS AWESOME
overflow:hidden;
overflow-y:hidden;
word-break:break-word;
text-overflow:ellipsis;
CSS
.box {
border:0.1em solid white;
width: 4em;
padding:0.3em;
}
position
position: relative absolute fixed sticky
static
postion:relative
postion:absolute
postion:fixed
postion:sticky
postion:static
relative | static | |
---|---|---|
z-index | ✔️ | 🚫 |
top, bottom, left, right | ✔️ | 🚫 |
holds absolute | ✔️ | 🚫 |
* { position:relative; }
float
float
<article>
<img class="float-left" src="..." />
<p>...</p>
<p>...ss</p>
</article>
Of course.
.container:after {
content: "";
display: table;
clear: both;
}
CSS
.riker {
float: left;
width: calc(33% - 30px);
margin-left: 15px;
margin-right: 15px;
}
grid
.all-rikers {
display:grid;
grid-template-columns: repeat(3,1fr);
grid-gap:30px;
}
grid-template-columns
grid-template-columns: 1fr 1fr 1fr; repeat(3, 1fr); 260px 50% 1fr; repeat(auto-fill,260px); repeat(auto-fit, minmax(160px,1fr))
1fr = 1 fraction
grid-template-columns: 1fr 1fr;
grid-template-columns: repeat(4,1fr);
grid-template-columns:200px 1fr 1fr;
grid-template-columns:repeat(auto-fill,240px);
repeat( auto-fill, minmax(250px, 1fr) );
.grid {
grid-template-columns: repeat(4,1fr);
}
.mojito, .daiquiri, .pina-colada {
grid-column: span 2;
grid-row: span 2;
}
HTML
css.collins { order: 1; }
.martini { order: 2; }
.tulip { order: 3; }
.margarita { order: 4; }
Takeaways:
flex
.all-rikers {
display: flex;
flex-wrap:wrap;
justify-content: space-between;
}
.riker {
flex-basis:calc(33% - 15px);
flex-grow: 0;
flex-shrink:1;
margin-bottom:30px;
}
Flex can be used with or instead of CSS grid
.flex-container {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
Vertical Centering with Flex!
.flex-container {
display: flex;
align-items: center;
/* ^- vertical */
justify-content: center;
/* ^- horizontal */
}
!important
being the nuclear optionHTML
CSS
article p { background: orange; }
#MyParagraph { color:red; }
p { background: green; }
a.link { background:blue; }
a[href] { color:yellow; }
a { background:green; }
by Thomas H. Park
by Thomas H. Park
CSS GIFs by Lynn Fisher