Skip to content

Instantly share code, notes, and snippets.

@guydumais
Last active September 1, 2024 20:19
Show Gist options
  • Save guydumais/53381f54712608f0602160ab3bade921 to your computer and use it in GitHub Desktop.
Save guydumais/53381f54712608f0602160ab3bade921 to your computer and use it in GitHub Desktop.
/*
Post structure:
<main>
<section>
<article>
<header>
<h1>Main Post Title</h2>
<p>Intro text</p>
</header>
<div class="content">
<figure class="featured-image"><img>....</figure>
<p>First paragraph</p>
<p>other paragraph</p>
...
<p>Last paragraph</p>
</div>
<footer>
<div class="author">Author component</div>
</footer>
</article>
</section>
</main>
*/
/* Base Styles - Mobile First */
body {
font-family: Arial, sans-serif;
line-height: 1.6;
margin: 0;
padding: 0;
}
main {
padding: 16px;
margin: 0 auto;
}
section {
margin-bottom: 24px;
}
article {
background-color: #fff;
padding: 16px;
border: 1px solid #ddd;
border-radius: 4px;
}
header {
margin-bottom: 16px;
}
h1 {
font-size: 24px;
margin: 0 0 8px 0;
line-height: 1.4;
}
p {
margin-bottom: 16px;
}
.featured-image {
margin-bottom: 16px;
text-align: center;
}
.featured-image img {
max-width: 100%;
height: auto;
border-radius: 4px;
}
footer {
margin-top: 24px;
border-top: 1px solid #ddd;
padding-top: 16px;
}
.author {
font-size: 14px;
color: #555;
}
/* Styles for Devices in Portrait Orientation */
@media screen and (orientation: portrait) {
h1 {
font-size: 28px;
}
p {
font-size: 16px;
}
.author {
text-align: center;
}
}
/* Styles for Devices in Landscape Orientation */
@media screen and (orientation: landscape) {
main {
padding: 20px;
}
article {
padding: 24px;
margin: 0 auto;
max-width: 90%;
}
h1 {
font-size: 26px;
}
p {
font-size: 15px;
}
.featured-image {
margin-bottom: 20px;
}
.author {
font-size: 15px;
}
}
/* Tablet and Larger Screens */
@media screen and (min-width: 768px) {
main {
padding: 24px;
}
article {
max-width: 700px;
margin: 0 auto;
}
h1 {
font-size: 32px;
}
p {
font-size: 18px;
}
footer {
margin-top: 32px;
}
}
/* Desktop and Larger Screens */
@media screen and (min-width: 1024px) {
main {
padding: 32px;
}
article {
max-width: 800px;
padding: 32px;
}
h1 {
font-size: 36px;
}
p {
font-size: 20px;
}
.author {
font-size: 16px;
text-align: left;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment