Skip to content

Instantly share code, notes, and snippets.

@matt-daniel-brown
Created February 7, 2019 20:09
Show Gist options
  • Save matt-daniel-brown/dc892f2f99b6484003513cd520c5e4ca to your computer and use it in GitHub Desktop.
Save matt-daniel-brown/dc892f2f99b6484003513cd520c5e4ca to your computer and use it in GitHub Desktop.
HTML & CSS - Study #1
<div class="container">
<!-- First Card -->
<section class="card">
<div class="card-content with-bg">
<header>
<h2>Mark Manson</h2>
<h1>
The<br>
Dark Side<br>
of the<br>
Digital<br>
Nomad
</h1>
<a>Travel</a>
</header>
</div>
<nav class="card-nav">
<a>close</a>
<ol>
<li class="active"></li>
<li></li>
<li></li>
<li></li>
</ol>
<a>
<i class="material-icons">
chat_bubble_outline
</i>
</a>
</nav>
</section>
<!-- Second Card -->
<section class="card">
<div class="card-content">
<p>
The following is the original piece I wrote for CNN last year entrepreneurs,
also known as “digital nomads.” Since the whole “Work Online, Travel the World
and Live the Dream” angle had been done to death in a million places,
I decided to go the other direction and show the dark side of being a digital
nomad — the challenges one faces, the emotional pitfalls, the social sacrifices.
</p>
<p>
Predictably, CNN hated it. The editors hacked it to pieces and asked me to rewrite
sections to make it less gloomy. But I was always fond of the original, so
I’m posting it here unabridged.
</p>
</div>
<nav class="card-nav">
<a>close</a>
<ol>
<li></li>
<li class="active"></li>
<li></li>
<li></li>
</ol>
<a>
<i class="material-icons">
chat_bubble_outline
</i>
</a>
</nav>
</section>
<!-- Third Card -->
<section class="card">
<div class="comments">
<header>
<h1>Comments (45)</h1>
<a>
<i class="material-icons">
clear
</i>
</a>
</header>
<ol>
<li class="comment">
<img src="https://s.cdpn.io/profiles/user/493569/80.jpg?2" alt="kaiquezimerer" />
<div>
<h3>kaiquezimerer</h3>
<h4>3 hours ago</h4>
<p>
Good point! There are travel bloggers.
Then there are freelancers: coders mainly.
</p>
</div>
</li>
<li class="comment">
<img src="https://randomuser.me/api/portraits/women/21.jpg" alt="annkeind" />
<div>
<h3>annkeind</h3>
<h4>4 hours ago</h4>
<p>
Not one family in amongst that. Being
nomadic in easier when you only have
1 person to worry about.
</p>
</div>
</li>
<li class="comment">
<img src="https://randomuser.me/api/portraits/men/61.jpg" alt="robert38" />
<div>
<h3>robert38</h3>
<h4>4 hours ago</h4>
<p>
Not saying it's not doable, some good
friends of mine manage ot but would
have been a better artiile width a 50/50
</p>
</div>
</li>
<li class="comment">
<img src="https://pbs.twimg.com/profile_images/1071254960271175680/Y0XPFHJq.jpg" alt="sullivan_" />
<div>
<h3>sullivan_</h3>
<h4>6 hours ago</h4>
<p>
Here people do business from the road
(running an IT company), travelling
and filming their trave
</p>
</div>
</li>
</ol>
</div>
</section>
</div>
/**- Reset -**/
*,
*:after,
*:before {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
color: #333;
font-family: Arial, sans-serif;
}
ol,
ul {
list-style: none;
}
/**- Container -**/
.container {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-around;
width: 100%;
height: auto;
min-height: 100%;
background-color: #cfd8dc;
}
/**- Card -**/
.card {
margin: 20px;
width: 320px;
height: 530px;
background-color: #fff;
box-shadow: 0 0 20px rgba(#333, 0.2);
transition: 400ms ease-in-out;
&:hover {
transform: translateY(-2px);
box-shadow: 10px 10px 50px rgba(#333, 0.2),
10px -10px 50px rgba(#333, 0.2);
}
}
/**- Card Content -**/
.card-content {
position: relative;
height: 90%;
padding: 2em;
background-color: #eceff1;
&.with-bg {
background: url(https://images.unsplash.com/photo-1543562759-21a00a82b61c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=747&q=80)
no-repeat center center;
background-size: cover;
}
header {
position: absolute;
bottom: 10px;
}
h1,
h2 {
color: #fff;
line-height: 1.3;
font-family: "Josefin Sans", sans-serif;
text-transform: uppercase;
text-shadow: 0 0 4px rgba(#333, 0.5);
}
h1 {
font-size: 2em;
}
h2 {
margin: 8px 0;
font-size: 0.5em;
letter-spacing: 2px;
}
a {
cursor: pointer;
display: inline-block;
padding: 8px 12px;
margin: 30px 0;
background: linear-gradient(#fff, #eceff1);
border-radius: 2px;
box-shadow: -1px 0 5px rgba(#333, 0.1);
font-size: 0.6em;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 1px;
&:hover {
opacity: 0.9;
}
}
p {
margin-bottom: 30px;
color: rgba(#444, 0.9);
font-family: "Merriweather", serif;
font-size: 0.8em;
line-height: 1.9;
&:first-child:first-letter {
float: left;
display: inline;
padding: 25px 10px 15px 0;
color: #333;
font-size: 5em;
line-height: 0.2;
}
}
}
/**- Card Navigation -**/
.card-nav {
display: flex;
align-items: center;
justify-content: space-around;
height: 10%;
box-shadow: -1px 0 5px rgba(#333, 0.1);
font-size: 0.7em;
a {
cursor: pointer;
font-weight: 700;
text-transform: uppercase;
}
i {
font-size: 1.6em;
}
li {
cursor: pointer;
display: inline-block;
margin: 0 2px;
width: 5px;
height: 5px;
border-radius: 50%;
background-color: #cfd8dc;
&.active {
background-color: #333;
}
}
}
/**- Comments -**/
.comments {
position: relative;
padding: 2em;
header {
margin-bottom: 30px;
}
h1 {
font-size: 0.7em;
font-weight: 700;
text-align: center;
text-transform: uppercase;
}
a {
position: absolute;
top: 27px;
right: 25px;
cursor: pointer;
}
}
/**- Comment -**/
.comment {
display: flex;
padding: 10px 0;
img {
width: 50px;
height: 50px;
border-radius: 50%;
margin-right: 20px;
}
h3,
h4 {
display: inline-block;
font-size: 0.6em;
font-family: "Merriweather", serif;
}
h4 {
color: rgba(#333, 0.4);
&:before {
content: "\25CF";
margin: 0 5px;
}
}
p {
margin: 5px 0;
line-height: 1.8;
font-size: 0.6em;
font-family: "Merriweather", serif;
}
}
<link href="https://fonts.googleapis.com/css?family=Josefin+Sans|Merriweather" rel="stylesheet" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment