Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

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.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <html>
    <head>
        <title> HOT CHOCOLATE CRAVING</title>
        <link href="https://fonts.googleapis.com/css?family=Lato:300,700,900|Roboto:400,700&display=swap" rel="stylesheet">
        <link href="https://fonts.googleapis.com/css2?family=Calligraffitti&display=swap" rel="stylesheet">
        <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.css" rel="stylesheet">
       <link rel="stylesheet" href="practice2.css">
    </head>

   <body>
    <header class="header header-home main-grid">
            <div class="header-content">
               
                <button aria-label="Open navigation" class="open-nav">&#9776;</button>
                
                <nav class="nav">
                    <button aria-label="Close navigation" class="close-nav">&times;</button>
                    <ul class="nav-list">
                        <li class="nav-item"><a href="" class="nav-link">HOME</a></li>
                        <li class="nav-item"><a href="" class="nav-link">ABOUT ME</a></li>
                        <li class="nav-item"><a href="" class="nav-link">CONTACT</a></li>
                    </ul>
                </nav>
            </div>
    </header>

     <main>
     	<section class="hero main-grid">
     		<div class="col-2">
	     		<h1 class="hero-title">Hot Chocolate Craving</h1>
	     		<p class="subtitle">I'm a music producer and web developer from London - and I absolutely love hot chocolate. I enjoy visiting beautiful cafes trying out different hot chocolates. I know the right textures and consistencies for the perfect hot chocolate. Think of me as a hot chocolate connoisseur if you will! </p>
	     		<a href="" class="btn btn-primary">Contact me</a>
	     	</div>	
     	</section>
     	
     	<section class="info main-grid">
     		<div class="col">
     			<h2 class="section-title section-title-center">About me</h2>
     			<p>Everyone needs something to make them smile no matter what. For me, hot chocolate does this! Of course, my work as a music producer and web developer makes me smile however, hot chocolate is great as a non-work related passion. I love exploring different cafes and restaurants for good hot chocolate. Welcome to my hot chocolate tasting journey!</p>
     		</div>
     		<div class="col">
     			<h2 class="section-title section-title-center">Ideal hot chocolate</h2>
     			<p>The best hot chocolates tend to be very frothy, with a smooth velvety texture and doesn't taste too sweet. However, there are exceptions to this. I've actually tasted hot chocolate that wasn't frothy and it tasted great. So, there's lots of variety and they're mostly all good. I explore this throughout this site!</p>
     		</div>
     		<div class="col">
     			<h2 class="section-title section-title-center">Get in touch</h2>
     			<p>If you know of a great hot chocolate brand, cafe, restaurant etc...please let me know! Also, if you'd like to feature your cafe/restaurant/bar on my website, feel free to get in touch. Hot chocolate never fails to make people smile, so lets spread this happiness!</p>
     		</div>
     	</section>
     </main>


    <footer class="footer main-grid">
            <div class="footer-main ">
                <img src="img/logo.png" alt="" class="footer-logo">
                <p class="footer-text">I'm a music producer and web developer from London - and I absolutely love hot chocolate. Think of me as a hot chocolate connoisseur if you will!</p>
                <p class="footer-fineprint">© 2020 Katriona Coder</p>
            </div>
            <ul class="social-list">
                <li class="social-item"><a href="#" class="social-link"><i class="fab fa-twitter"></i></a></li>
                <li class="social-item"><a href="#" class="social-link"><i class="fab fa-instagram"></i></a></li>
            </ul>
        </footer>

        <script src="script.js"></script>
   </body>

</html>

              
            
!

CSS

              
                * {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: 'Lato', sans-serif;
	font-size: 1rem;
	color: #404040;
	line-height: 1.6;
}

/* TYPOGRAPHY */
h1, h2, strong {
	font-weight: 700;
}

.hero-title {
	font-size: 1.5rem;
	line-height: 1.4;
	margin-bottom: 0;
}

.section-title {
    font-size: 1.125rem;
    color: #000;
    margin-top: 1.25em;
}

/* BUTTONS */
.btn {
	padding: .5em 1.75em;
	margin-top: .5em;
	text-decoration: none;
	font-weight: 700;
}

.btn-primary {
	background: yellow;
	color: black;
}

/* GENERAL LAYOUT */
.main-grid {
	display: grid;
	grid-template-columns: minmax(1em, 1fr) minmax(0px, 500px) minmax(1em, 1fr);
	grid-column-gap: 2em;
}

@media (min-width: 600px) {
    .main-grid {
        grid-template-columns: minmax(1em, 1fr) repeat(3, minmax(150px, 320px)) minmax(1em, 1fr);
    }
}


/* NAVIGATION */
.header {
    background: black;
}

.header-home {
    background: transparent;
    position: absolute;
    width: 100%; /* Use width: 100% to stop the navigation becoming misaligned with the header. 
                    Example: https://scrimba.com/p/pqxQPfJ/c66mvgT9 */
}

.header-content {
    display: flex;
    grid-column: 2 / -2;
}

.logo-link {
    background-color: #FFE600;
    padding-top: 2em;
}

.nav {
    position: fixed;
    background: #000;
    width: 100%;
    top: 0;
    right: 0;
    bottom: 0;
    left: 100%;
    transform: translateX(0);
    transition: transform 250ms;
}

.navigation-open {
    transform: translateX(-100%);
}

.nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    height: 100%;
    align-items: center;
    justify-content: space-around;
    flex-direction: column;
}

.nav-link {  
  color: #fff;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 700;
}

.nav-link:hover,
.nav-link:focus {
    color: #FFE600;
}

.close-nav {
    border: 0;
    background: 0;
    color: #FFE600;
    font-weight: 700;
    font-size: 3rem;
    cursor: pointer;
    padding: .5em;
    position: absolute;
}

.open-nav {
    border: 0;
    background: 0;
    color: #fff;
    cursor: pointer;
    padding: .5em;
    margin-left: auto;
    font-size: 1.5em;
}


@media (min-width: 600px) {
    .open-nav,
    .close-nav {
        display: none;
    }
    
    .nav {
        position: initial;
    }
    
    .nav-list {
        flex-direction: row;
        justify-content: flex-start;
    }
    
    .nav-item {
        margin-left: 1em;
    }
    
    .nav-link {
        font-size: 1rem;
    }

    .header-home .nav {
    background: transparent;
}
}



/* FOOTER */
.footer {
    background: #ebebeb;
    padding: 4em 0;
    text-align: center;

    grid-template-areas:
        ". social ."
        ". main .";
}

.footer-main,
.social-list {
    grid-column: 2 / -2;
}

.footer-fineprint {
    font-size: .75rem;
    margin-top: 4em;
}

.footer-main {
    grid-area: main;
}

.social-list {
	grid-area: social;
    list-style: none;
    padding: 0;
    margin: 0 0 2em;
    display: flex;
    justify-content: center;
}

.social-link {
	color: #000;
    font-size: 1.75rem;
    margin: 0 .5em;
}

.social-link:hover {
    color: #777;
}

@media (min-width: 600px) {
    .footer {
        grid-template-areas: 
          ". main main social ."
    }

    .footer-main {
        text-align: left;
    }
    
    .social-list {
        justify-content: flex-end;
    }
}

/* HERO AREA */

.hero {
	background: #000;
    background-size: cover;
	background-position: right;
	padding: 10em 0 4em;
	color: white;
}

.hero > * {
	grid-column: 2 / -2;
}


@media (min-width: 400px) {
    .hero > * {
        margin-right: 20%;
    }
} /* end */

@media (min-width: 600px) {
	.hero {
        padding: 10em 0 5em;
    }

	.hero > * {
		grid-column: 2 / span 2;
	}
}

/* INFO SECTION */
.info {
    padding: 4em 0;
    text-align: center;
}

.col {
    grid-column: 2 / -2;
}

@media (min-width: 600px) {
	.col {
		grid-column: span 1;
	}

	.col:first-child {
        grid-column: 2 / span 1;
    }
}
              
            
!

JS

              
                const closeButton = document.querySelector('.close-nav');
const openButton = document.querySelector('.open-nav');
const nav = document.querySelector('.nav');

closeButton.addEventListener("click", () => {
    nav.classList.remove('navigation-open');
}); 

openButton.addEventListener("click", () => {
    nav.classList.add('navigation-open');
}); 
              
            
!
999px

Console