Skip to content

Instantly share code, notes, and snippets.

@disooqi
Created February 24, 2021 01:06
Show Gist options
  • Save disooqi/2ba4ff2bb4091c2c781050ca0976bfb4 to your computer and use it in GitHub Desktop.
Save disooqi/2ba4ff2bb4091c2c781050ca0976bfb4 to your computer and use it in GitHub Desktop.
CSS Grid: Newspaper Layout
.main__wrapper
main
h1 The Codepen Times
aside
div
.issue Issue #1
.date Tuesday, 26 May, 2020
.edition Two memes Edition
h2.title--large.main-title Woman spends too much time on Codepens despite advice; no plans to stop
.main-text.multi-column
p Sometimes, Internet users land themselves in an uncommon situation where an app or website can be used for both work and personal situations. Well, a young front-end designer was spending up to 13 hours on the site, Codepen for work and her hobby, which unfortunately, is also coding.
p The designer, whose work includes a
em To-Do Terrarium
| , clarified, "Well, I didn't
em have
| to use it for work but it was already part of my workflow. It just made sense as it was more efficient." The biggest issue, she said, is that she would hop on Codepen for work, but would get distracted by pens made by others in the community for unexpectedly long periods of time, which then causes her to spend even more time on the site.
p "I mean, that's terrible right?" she asked. Codepen, which brands itself as the best place to build, test, and discover front-end code, has declined to comment at this time.
a(href="https://codepen.io/oliviale/full/oNXJgEM" target="_blank").terrarium
figure
img(src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/567707/showcase-terrarium.jpg")
figcaption A to-do list that grows succulents when you've completed a task
a(href="https://codepen.io/oliviale/full/moLrBq" target="_blank").item-with-image.plan.span--2.long--2
img(src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/567707/showcase-floorplan.jpg")
h4 Can you get inspired to make your own floor plans?
div.multi-column
p Making a floor Plan with CSS Grid? Talk about using the wrong tool for the job. But I guess this is what happens when someone isn't happy with any of the floor plans found on Pinterest; she'll start making her own for the eventual home that she will never own. Nevertheless, there's a home office with a large window to look out of pensively during rainy days and a ton of "white space" for the cats to run around.
a(href="https://codepen.io/oliviale/full/MZZYyO" target="_blank").hogwarts
.hogwarts__title 50% Off Hogwarts Express tickets
.hogwarts__image
span Limited time offer
img(src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/567707/showcase-hogwarts.svg")
a(href="https://codepen.io/oliviale/full/zYvxXWw" target="_blank").item-with-image.pasta.with-border
h4 A pasta menu
p Everybody loves pasta. It's impossible to not love them, so here are 15 recipes, served with GSAP. Note the easter egg — the menu icon changes according to the pasta that you choose.
a(href="https://codepen.io/oliviale/full/GRKQoKM" target="_blank").item-with-image.magazine.with-border
h4 Marvel at a magazine
p A tribute of sorts to an era of cool superhero movies, this is a Marvel-themed magazine! Recommended, because it took 45 hours, so you know some serious dedication has been poured into this.
a(href="https://codepen.io/collection/XJyNPm" target="_blank").item-with-image.style
h4 Let's adopt, don't shop.
p Explore a style guide and various page layouts for a pet adoption site in the
em Style Guide
| collection. Inspired by the
em Atomic Design
| principle, this 8-pen collection includes a 404 page concept, an admin dashboard and what a Twitter user calls a 'media card zen garden'. Each pen comes with five (yes, five) color themes, including the precious dark mode.
a(href="https://codepen.io/oliviale/full/xxboXzo" target="_blank").item-with-image.toggles
img(src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/567707/showcase-toggle.gif")
h4 Toggles
p Eight playful toggles to toggle on and off for your amusement. Is it possible to use these on your site and still adhere to assessibility rules? No. But there's a really cute dog one you
em have
| to see.
a(href="https://codepen.io/oliviale/full/LYYrKMV" target="_blank").menu
figure
img(src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/567707/showcase-menu.jpg")
figcaption See the new and improved menu for Toasty!
a(href="https://codepen.io/oliviale/full/QWjjrZX" tagrget="_blank").social
img.social__image(src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/567707/showcase-social.gif")
.social__subtitle World News
.social__content Looks like Covid-19 is gonna be around for a while so here is another friendly reminder to practice social distancing. Oh, and wear a mask!
.item-with-image.cssgrid-collection
a(href="https://codepen.io/collection/DQvYpQ" target="_blank").cssgrid-collection__image
img(src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/567707/showcase-co-grid.jpg")
.cssgrid-collection__content
h4
a(href="https://codepen.io/collection/DQvYpQ" target="_blank") More CSS Grid things like this one. Shelves, coupons and more!
div.multi-column-3
p Get your fill of more CSS Grid items in this collection. There are a total of 32 pens to date... well, 33, if you count this one too. What can you expect in this collection? The hidden gems, in my totally unbiased opinion, are
a(href="https://codepen.io/oliviale/full/wbyVWr" target="_blank") the recreation of the Pac-Man layout
| and
a(href="https://codepen.io/oliviale/pen/wbyVWr" target="_blank") coupons inspired by junk mail
|. A lot of joke items of things that shouldn't be done in CSS Grid, such as
a(href="https://codepen.io/oliviale/full/PXGgMG" target="_blank") a shelf
| ?
a(href="https://codepen.io/oliviale/full/qggOog" target="_blank") Bathroom tiles wtf
| ? and
a(href="https://codepen.io/oliviale/full/bOWqbj" target="_blank") makeup palettes
| . If you are a cultured person, you will have a chance to enjoy a couple of pens inspired by
a(href="https://codepen.io/oliviale/full/JxVZpX" target="_blank") Harry Potter
| and
a(href="https://codepen.io/oliviale/full/RwNdeeQ" target="_blank") Pokemon.
| On the rare occasion that you are looking at this profile for something you can use in production, you really shouldn't. But, there are
em some
| real-world applications, such as
a(href="https://codepen.io/oliviale/full/GPXozx" target="_blank") the recipe layout
| ,
a(href="https://codepen.io/oliviale/full/pqoEoJ" target="_blank") the product catalog
|, and
a(href="https://codepen.io/oliviale/full/XyqQYL" target="_blank") color palettes for a style guide
| .
.sidebar
h3.title--big Hot this month
a(href="https://codepen.io/oliviale/full/BaovGmg" target="_blank").codepen-item.pie
img.pie__image(src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/567707/showcase-pie.jpg")
.pie__subtitle Food
.pie__content
h4 Pies for everyone!
p No man is left behind. There's infinite pie with this one div and a repeating background.
a(href="https://codepen.io/oliviale/full/RwWdNRd" target="_blank").sidebar-item.captcha
h5 Frustrated designer runs amok with Captcha ideas
p From Tic Tac Toe to solving meme-based questions, this is a different take on how web captchas should be. "I have not successfully picked out all photos of a truck on the first try. Something's gotta change," says the designer, who has requested to remain anonymous.
a(href="https://codepen.io/oliviale/full/GRpvNBa" target="_blank").sidebar-item.slack-ui.with-border
h5 Slack UI gets reverse engineered
p Another valiant effort to reverse engineer a web app. However, the UI is repurposed to showcase Codepens instead of mock conversations. This is a codepen showcase inception situation.
a(href="https://codepen.io/oliviale/full/RwWKybY" target="_blank").workout
.workout__image
img(src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/567707/showcase-workout.jpg" alt="Workout")
.workout__blurb Always failing to keep track of your workouts?
.workout__title Use this tool!
:root {
--font: "EB Garamond", serif;
--font-title: "Playfair Display", serif;
--font-sans-serif: "Manrope", sans-serif;
--black: #1c1f33;
--gray: #eee;
--gray-1: #ededed;
}
* {
box-sizing: border-box;
}
@mixin double-border {
border: 2px solid transparent;
outline: 3px solid var(--black);
box-shadow: inset 0 0 0 1px var(--black);
}
body {
font-size: 1.1rem;
background: var(--preview-bg);
font-family: var(--font);
color: var(--black);
background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/567707/paper_fibers.png)
repeat;
padding: 4rem 2rem;
line-height: 1.3;
text-align: justify;
column-break-inside: avoid;
}
a {
text-decoration: none;
display: block;
color: var(--black);
&:hover,
&:focus,
&:active,
&:visited {
color: var(--black);
}
}
.main__wrapper {
max-width: 1135px;
margin: auto;
}
h1 {
font: 50px/1 "Playfair Display SC";
text-align: center;
@media (min-width: 700px) {
font: 70px/1 "Playfair Display SC";
}
}
h3 {
font: italic 20px var(--font-title);
margin-bottom: 1rem;
}
h4 {
font: 20px/1.2 var(--font-title);
}
h5 {
font: 700 20px/1 var(--font);
transition: 0.3s ease;
}
p {
line-height: 1.3;
a {
display: inline;
}
}
em {
font-style: italic;
}
.title--large {
font-family: var(--font-title);
font-size: 32px;
font-style: italic;
text-align: left;
margin-bottom: 0.8rem;
@media (min-width: 700px) {
font-size: 42px;
margin: 0;
}
}
main {
@media (min-width: 700px) {
display: grid;
grid-template-columns: repeat(4, 1fr) 23%;
grid-template-rows: repeat(5, auto);
grid-gap: 1.2rem;
}
h1,
aside {
grid-column: 1 / -1;
}
.main-title {
@media (min-width: 700px) {
grid-column: 1 / -1;
}
@media (min-width: 1024px) {
grid-column: 1 / -2;
}
}
.terrarium {
@media (min-width: 700px) {
grid-column: 1 / -1;
}
@media (min-width: 1024px) {
grid-column: 3 / span 2;
}
}
.main-text {
@media (min-width: 700px) {
grid-column: span 5;
}
@media (min-width: 1024px) {
grid-column: span 2;
}
}
.sidebar {
@media (min-width: 700px) {
grid-column: 1 / -1;
}
@media (min-width: 1024px) {
grid-row: 3 / 9;
grid-column: 5 / 6;
}
}
.social {
grid-column: 1 / -2;
grid-row: 8 / 9;
}
.article-bar-1 {
grid-row: span 4;
}
.hogwarts {
@media (min-width: 700px) {
grid-row: span 3;
}
@media (min-width: 1024px) {
grid-column: 3;
grid-row: span 2;
}
}
.menu {
@media (min-width: 700px) {
grid-column: 1 / -1;
grid-row: 13;
}
@media (min-width: 1024px) {
grid-row: 7 / 8;
grid-column: 2 / 4;
}
}
.toggles {
@media (min-width: 700px) and (max-width: 1024px) {
grid-column: 3 / 6;
grid-row: 10 / 13;
}
}
.plan {
@media (min-width: 700px) and (max-width: 1024px) {
grid-column: span 4;
}
}
.style,
.magazine,
.pasta {
@media (min-width: 700px) and (max-width: 1024px) {
grid-column: 1 / 3;
}
}
.cssgrid-collection {
grid-column: 1 / -1;
grid-row: 9;
}
}
.span--2 {
grid-column: span 2;
}
.long--2 {
grid-row: span 2;
}
.long--4 {
grid-row: span 4;
}
.with-border {
border-top: 1px solid;
padding-top: 0.6rem;
}
img {
width: 100%;
filter: grayscale(95%);
margin-bottom: 0.5rem;
border: 1px solid var(--black);
transition: 0.3s ease;
}
figcaption {
font-style: italic;
font-size: 90%;
}
aside {
text-align: center;
padding: 3px 0;
border: solid var(--black);
border-width: 2px 0;
text-transform: uppercase;
letter-spacing: 1px;
margin: 1.5rem 0;
@media (min-width: 700px) {
margin: 0;
}
> div {
display: flex;
align-items: center;
border: solid var(--black);
border-width: 1px 0;
> div {
flex: 1;
padding: 8px;
}
}
}
@media (min-width: 700px) {
.multi-column {
column-count: 2;
column-gap: 1.3rem;
margin-top: 0.75rem;
&-3 {
column-count: 3;
}
}
}
.sidebar {
margin-top: 3rem;
@media (min-width: 700px) and (max-width: 1024px) {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: flex-start;
margin: 0;
h3 {
width: 100%;
text-align: center;
}
> a {
flex: 0 1 48%;
margin: 1.5rem 0;
padding: 0;
}
.slack-ui {
border-top: 0;
}
.pie {
order: 3;
}
}
@media (min-width: 1024px) {
display: block;
border-left: 1px solid;
padding-left: 1.2rem;
margin: 0;
}
}
.main-text.multi-column {
margin: 0;
p {
margin-bottom: 0.8rem;
}
}
.hogwarts {
text-align: center;
height: 100%;
@include double-border;
width: calc(100% - 4px);
margin: 1.5rem auto;
overflow: hidden;
@media (min-width: 700px) {
margin: 0;
}
&__title {
font: 800 24px/1 var(--font-sans-serif);
text-transform: uppercase;
background: var(--black);
color: var(--gray);
padding: 0.8rem 0.8rem 0.9rem;
transition: 0.2s ease;
@media (min-width: 700px) and (max-width: 1024px) {
font: 800 21px/1.2 var(--font-sans-serif);
padding: 1.5rem 0.5rem;
}
}
&__image {
height: 100%;
position: relative;
img {
transform: rotate(60deg);
height: 150%;
position: absolute;
border: 0;
width: 250%;
left: -70%;
bottom: -35%;
@media (min-width: 700px) and (max-width: 1024px) {
bottom: -20%;
}
}
span {
font-style: italic;
max-width: 110px;
position: absolute;
top: 7%;
left: 18%;
font-size: 22px;
line-height: 0.9;
transform: rotate(-5deg);
}
}
}
.terrarium {
margin: 1.5rem 0;
@media (min-width: 700px) {
margin: 0 0 1.5rem;
}
figure {
height: 100%;
}
img {
height: 96%;
object-fit: cover;
object-position: right;
}
}
.pie {
line-height: 0;
color: var(--gray);
text-align: left;
&__image {
margin: 0;
border: 0;
max-height: 15rem;
object-fit: cover;
}
&__subtitle {
background: #999;
text-transform: uppercase;
line-height: 1;
padding: 0.4rem 1rem;
font: 14px var(--font-sans-serif);
color: var(--gray);
}
&__content {
background: #666;
padding: 1rem 1rem 1.2rem;
color: var(--gray);
p {
margin-top: 0.5rem;
}
}
}
.sidebar-item {
margin: 2rem 0;
padding: 2rem 0 0;
h5 {
text-align: center;
width: 100%;
padding: .5rem;
margin: auto;
}
p {
margin-top: 1rem;
}
&:hover {
h5 {
transition: 0.3s ease;
background: var(--black);
color: #fff;
}
}
}
.item-with-image {
margin-top: 1.5rem;
h4 {
font-size: 24px;
text-align: left;
margin-bottom: 0.5rem;
transition: 0.2s ease;
}
@media (min-width: 700px) {
margin: 0;
}
&:not(.cssgrid-collection):hover {
h4 {
color: white !important;
background: var(--black);
}
}
p {
}
img {
}
}
.magazine {
border: 1px solid;
border-width: 1px 0;
padding-bottom: 1rem;
}
.menu {
margin: 1.5rem 0;
@media (min-width: 1024px) {
margin: 0;
}
figure {
height: 100%;
}
img {
height: 90%;
object-fit: cover;
object-position: left;
}
}
.cssgrid-collection {
display: flex;
align-content: stretch;
border-top: 1px solid;
padding-top: 1rem;
h4 {
margin: 0 0 0.8rem;
}
&__image {
flex: 0 0 32%;
margin-right: 1.5rem;
}
img {
height: 100%;
object-fit: cover;
object-position: left;
}
p a {
border-bottom: 1px dashed;
&:hover {
border-bottom: 1px solid;
}
}
}
.captcha {
@media (min-width: 1024px) {
margin-top: 0;
}
}
.workout {
@include double-border;
width: calc(100% - 4px);
margin: 3rem auto 0.2rem;
&__image {
padding: 2px;
img {
height: 16rem;
object-fit: cover;
object-position: left;
border: none;
@media (min-width: 1024px) {
height: 25rem;
}
}
}
&__blurb {
font: 22px/1.1 var(--font-sans-serif);
text-align: center;
padding: 0.5rem;
color: var(--black);
margin: -1rem 0.5rem 0.3rem;
}
&__title {
font: 18px/1.1 var(--font-sans-serif);
text-transform: uppercase;
text-align: center;
padding: 1rem;
background: var(--black);
color: var(--gray);
transition: 0.2s ease;
}
}
.social {
display: grid;
grid-template-columns: 1fr 3fr;
grid-template-rows: max-content auto;
color: var(--gray);
text-align: left;
&__image {
margin: 0;
border: 0;
grid-row: span 2;
height: 100%;
object-fit: cover;
}
&__subtitle {
background: #999;
text-transform: uppercase;
line-height: 1;
padding: 0.4rem 1rem;
color: var(--gray);
font: 14px var(--font-sans-serif);
}
&__content {
background: #666;
padding: 1rem;
color: var(--gray);
grid-column: 2;
}
}
.plan {
padding-bottom: 1rem;
@media (min-width: 700px) and (max-width: 1024px) {
grid-column: span 3;
margin: 0 0 1.5rem;
}
@media (min-width: 1024px) {
border-bottom: 1px solid;
}
}
.pie,
.social,
.menu,
.terrarium,
.plan,
.toggles,
.workout,
.cssgrid-collection__image {
&:hover img {
filter: grayscale(0);
}
}
.workout {
&:hover .workout__title {
background: transparent;
color: var(--black);
}
}
.hogwarts {
&:hover .hogwarts__title {
background: transparent;
color: var(--black);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment