HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<!-- header starts -->
<header>
<div class='container container-flex'>
<div class='site-title'>
<h1>Living The Social Life</h1>
<p class='subtitle'>A blog exploring minimalism in life.</p>
</div>
<nav>
<ul>
<li> <a href='#' class='current-page'>Home</a> </li>
<li> <a href='#'>About Me</a> </li>
<li> <a href='#'>Recent Posts</a> </li>
</ul>
</nav>
</div>
</header>
<!-- header ends -->
<!-- container starts -->
<div class="container container-flex">
<main role="main">
<article class="article-featured">
<h2 class="article-title">Finding simplicity in life</h2>
<img src="https://raw.githubusercontent.com/kevin-powell/reponsive-web-design-bootcamp/master/Module%202-%20A%20simple%20life/img/life.jpg" alt="simple white desk on a white wall with a plant on the far right side" class="article-image">
<p class="article-info">July 23, 2019 | 3 comments</p>
<p class="article-body">Life can get complicated really quickly, but it doesn't have to be! There are many ways to simplify your life, a few of which we've explored in the past. This week we're taking a bit of a approach though, in how you can find simplicity in the life you already living.</p>
<a href="#" class="article-read-more">CONTINUE READING</a>
</article>
<article class="article-recent">
<div class="article-recent-main">
<h2 class="article-title">Keeping cooking simple </h2>
<p class="article-body">Food is a very important part of everyone's life. If you want to be healthy, you have to eat healthy. One of the easiest ways to do that is to keep your cooking nice and simple.</p>
<a href="#" class="article-read-more">CONTINUE READING</a>
</div>
<div class="article-recent-secondary">
<img src="https://raw.githubusercontent.com/kevin-powell/reponsive-web-design-bootcamp/master/Module%202-%20A%20simple%20life/img/food.jpg" alt="two dumplings on a wood plate with chopsticks" class="article-image">
<p class="article-info">July 19, 2019 | 3 comments</p>
</div>
</article>
<article class="article-recent">
<div class="article-recent-main">
<h2 class="article-title">Simplicity and work </h2>
<p class="article-body">Work is often a major source of stress. People get frustrated, it ruins their relationship with others and it leads to burnout. By keeping your work life as simple as possible, it will help balance everything out.</p>
<a href="#" class="article-read-more">CONTINUE READING</a>
</div>
<div class="article-recent-secondary">
<img src="https://raw.githubusercontent.com/kevin-powell/reponsive-web-design-bootcamp/master/Module%202-%20A%20simple%20life/img/work.jpg" alt="a chair white chair at a white desk on a white wall" class="article-image">
<p class="article-info">July 12, 2019 | 3 comments</p>
</div>
</article>
<article class="article-recent">
<div class="article-recent-main">
<h2 class="article-title">Simple decorations</h2>
<p class="article-body">A home isn't a home until you've decorated a little. People either don't decorate, or they go overboard and it doesn't have the impact they were hoping for. Staying simple will help draw the eye where you want it to and make things pop like never before.</p>
<a href="#" class="article-read-more">CONTINUE READING</a>
</div>
<div class="article-recent-secondary">
<img src="https://raw.githubusercontent.com/kevin-powell/reponsive-web-design-bootcamp/master/Module%202-%20A%20simple%20life/img/work.jpg" alt="a green plant in a clear, round vase with water in it" class="article-image">
<p class="article-info">July 3, 2019 | 3 comments</p>
</div>
</article>
</main>
<aside class="sidebar">
<div class="sidebar-widget">
<h2 class="widget-title">ABOUT ME</h2>
<img src="https://raw.githubusercontent.com/kevin-powell/reponsive-web-design-bootcamp/master/Module%202-%20A%20simple%20life/img/about-me.jpg" alt="john doe" class="widget-image">
<p class="widget-body">I find life better, and I'm happier, when things are nice and simple.</p>
</div>
<div class="sidebar-widget">
<h2 class="widget-title">RECENT POSTS</h2>
<div class="widget-recent-post">
<h3 class="widget-recent-post-title">Keeping cooking simple</h3>
<img src="https://raw.githubusercontent.com/kevin-powell/reponsive-web-design-bootcamp/master/Module%202-%20A%20simple%20life/img/food.jpg" alt="two dumplings on a wood plate with chopsticks" class="widget-image">
</div>
<div class="widget-recent-post">
<h3 class="widget-recent-post-title">Simplicity and work</h3>
<img src="https://raw.githubusercontent.com/kevin-powell/reponsive-web-design-bootcamp/master/Module%202-%20A%20simple%20life/img/work.jpg" alt="a chair white chair at a white desk on a white wall" class="widget-image">
</div>
<div class="widget-recent-post">
<h3 class="widget-recent-post-title">Simple decorations</h3>
<img src="https://raw.githubusercontent.com/kevin-powell/reponsive-web-design-bootcamp/master/Module%202-%20A%20simple%20life/img/deco.jpg" alt="a green plant in a clear, round vase with water in it" class="widget-image">
</div>
</div>
</aside>
</div>
<!-- container ends -->
<!-- footer starts -->
<footer>
<p><strong>Living the Simple Life</strong></p>
<p>Copyright 2021, <a href='akramnarejo.github.io' target='_blank'>Akram Narejo</a></p>
</footer>
<!-- footer ends -->
</body>
</html>
/* Typography */
@import url('https://fonts.googleapis.com/css2?family=Lora&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Lora&family=Ubuntu:wght@300;400;700&display=swap');
body {
margin: 0;
font-family: 'Ubuntu', sans-serif;
font-size: 1.125rem;
font-weight: 300;
}
h1,
h2,
h3 {
font-family: 'Lora', serif;
font-weight: 400;
color: #143774;
margin-top: 0;
}
h1{
font-size: 2rem;
margin: 0;
}
a {
color: #1792d2;
}
a:hover,
a:focus {
color: #143774;
}
strong {
font-weight: 700;
}
.subtitle{
font-size: 0.85rem;
font-weight: 700;
margin: 0;
color: #1792d2;
letter-spacing: 0.05em;
font-family: 'Ubuntu Bold', sans-serif;
}
.article-title {
font-size: 1.5rem;
}
.article-read-more,
.article-info {
font-size: .875rem;
}
.article-read-more {
color: #1792d2;
text-decoration: none;
font-weight: 700;
}
.article-read-more:hover,
.article-read-more:focus {
color: #143774;
text-decoration: underline;
}
.article-info {
margin: 2em 0;
}
header{
padding: 2em 0;
text-align: center;
background: #f0f8ff;
font-family: sans-serif;
margin-bottom: 3em;
}
.container-flex{
max-width: 70vw;
margin: 0 auto;
display: flex;
justify-content: space-between;
margin-bottom: 1em;
}
nav ul{
display: flex;
justify-content: center;
list-style: none;
padding: 0;
}
nav li{
margin: 0 1em;
}
nav a{
text-decoration: none;
color: #707070;
font-weight: 700;
padding: 0.25em 0;
}
nav a:hover,
nav a:focus{
color: #143774;
border-bottom: 1px solid black;
transition: .3s ease;
}
img{
max-width: 100%;
display: block;
}
main{
max-width: 75%;
}
.article-body{
width: 100%;
text-align: justify;
}
.sidebar{
max-width: 23%;
}
footer {
background:#143774;
color: white;
text-align: center;
padding: 3em 0;
}
footer a{
text-decoration: none;
color: white;
}
footer a:hover{
text-decoration: underline;
color: white;
}
@media (max-width:1050px){
.container-flex{
flex-direction: column;
}
.site-title, .subtitle{
width: 100%;
}
main{
max-width: 100%;
}
.sidebar{
max-width: 100%;
}
}
@media (max-width: 500px){
nav ul{
display: flex;
flex-direction: column;
}
nav li{
margin: 0.5em 0;
}
}
/* articles */
.article-featured {
border-bottom: #707070 1px solid;
padding-bottom: 2em;
margin-bottom: 2em;
}
.article-recent {
display: flex;
flex-direction: column;
margin-bottom: 2em;
}
.article-recent-main {
order: 2;
}
.article-recent-secondary {
order: 1;
}
@media (min-width: 675px) {
.article-recent {
flex-direction: row;
justify-content: space-between;
}
.article-recent-main {
width: 68%;
}
.article-recent-secondary {
width: 30%;
}
}
Also see: Tab Triggers