My web application currently lists content like this:
I used Microsoft Paint to render what I WANT it to looks like here:
I attempted to create a "grid inside of a grid" but failed miserably and I'm hoping someone can assist me. I'm guessing that I might be able to use flexbox to achieve the desired result, but I am not entirely sure. I'm also not sure how to group the content into individual "cards". Doing so would make things a bit more organized, I think.
The following is my CSS code:
body {
display: grid;
grid-template-areas:
'header header header'
'nav article ads'
'nav footer footer';
grid-template-rows: 80px 1fr 70px;
grid-template-columns: 20% 1fr 15%;
grid-row-gap: 1px;
grid-column-gap: 1px;
height: 100vh;
margin: 0;
}
a {
color: #0ad05b;
text-decoration: none;
}
a:hover {
color: #e3eaee;
}
header {
padding: 1.2em;
background: #21313c;
font-family: Helvetica, Arial, sans-serif;
color: #e3eaee;
}
footer,
article,
nav,
div {
padding: 1.2em;
background: #061621;
font-family: Helvetica, Arial, sans-serif;
color: #e3eaee;
}
textarea {
font-family: Arial, Helvetica, sans-serif;
}
#pageHeader {
grid-area: header;
}
#pageFooter {
grid-area: footer;
}
#mainArticle {
grid-area: article;
}
#mainNav {
grid-area: nav;
}
#siteAds {
grid-area: ads;
}
/* Stack the layout on small devices/viewports. */
@media all and (max-width: 575px) {
body {
grid-template-areas:
'header'
'article'
'ads'
'nav'
'footer';
grid-template-rows: 80px 1fr 70px 1fr 70px;
grid-template-columns: 1fr;
}
}
.big-user-photo {
border-radius: 50%;
}
.userAvatar {
height: 3.5rem;
width: 3.5rem;
border-radius: 50%;
margin-right: 1rem;
}
.mainPage {
height: 3.5rem;
width: 3.5rem;
border-radius: 50%;
margin-right: 1rem;
}
The relevant jade code is here:
extends base
block content
article#mainArticle
each ship in ships
.innerArticle
img.mainPage(src=`/img/ships/${ship.shipPhoto}`, alt=`${ship.shipName}`)
p Ship: #{ship.shipName}
a(href=`/ship/${ship.slug}`) See Reviews