Skip to content

Instantly share code, notes, and snippets.

@rob-kistner
Last active October 10, 2020 01:36
Show Gist options
  • Select an option

  • Save rob-kistner/c642394fdcd583daf851da76f625280b to your computer and use it in GitHub Desktop.

Select an option

Save rob-kistner/c642394fdcd583daf851da76f625280b to your computer and use it in GitHub Desktop.
Various CSS
/*
CSS Box Borders
Borders will thicken the interior of containers by default. This means, in a case where there are more than one column next to each other, the containers meet will be double thickness. You can make them single thickness by removing the right border on all neighboring containers except the last one with `:not(:last-child)`.
*/
.col {
border: solid 5px red;
}
.col:not(:last-child) {
border-right: none;
}
/*
Flexbox Images
--------------
Images in a flexbox container will, by default, stretch to fill the container. This is due to flexbox's align-self value on items of 'stretch' by default. Changing this value to something else prevents the image from stretching.
*/
.col {
display: flex;
flex-direction: column;
}
.col img {
align-self: center;
max-width: 100%;
}
@media (min-width: 500px) {
.col {
width: 33.332%;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment