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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

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.

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

              
                <!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>css layout and positions</title>
    <link rel="stylesheet" href="style.css">
</head>

<body>

    <header>
        <h1>Konichiwa!</h1>
    </header>
    <section class="banner">
        <img class="hero" src="https://i.imgur.com/ShUiT9y.jpg" alt="tokyo at night">
        <div class="welcome">
            <h2>Tokyo,<br><span>Japan</span></h2>
        </div>
    </section>

    <nav class="main-nav">
        <ul>
            <li><a href="#">About</a></li>
            <li><a href="#">Contact Us</a></li>
            <li><a href="#">Tours</a></li>
            <li><a href="#">Blog</a></li>
        </ul>
    </nav>
    <main>
        <article>
            <h2>Let's explore Japan!</h2>
            <p>Curabitur ut aliquet justo. Suspendisse laoreet, tortor ut scelerisque condimentum, lorem sapien interdum
                risus, in malesuada libero tortor id lacus. Aliquam erat volutpat. Nulla diam quam, bibendum non euismod
                sit amet, pretium id nisi. Donec mollis nisl a sem maximus vestibulum. Cras imperdiet orci luctus lorem
                rutrum, non placerat dui laoreet. Nullam tristique sodales accumsan. Maecenas sed blandit diam. Nulla
                tincidunt, ex sollicitudin suscipit pretium, lacus purus mattis nunc, a consectetur arcu sapien sed
                urna. Nullam aliquam eget odio nec varius. Duis non leo et sapien venenatis ullamcorper. Nulla facilisi.
                Mauris egestas lacus risus. In non eros lobortis, interdum mi eu, tempus sapien. Pellentesque porttitor
                ligula pulvinar, viverra sapien non, sodales nisi.</p>
        </article>
        <ul class="images">
            <li><img src="https://i.imgur.com/zQMK7lO.jpg" alt="torii gate"></li>
            <li><img src="https://i.imgur.com/GoNzafD.jpg" alt="street"></li>
        </ul>
    </main>
    <section class="join">
        <h2>Sign up for a tour today!</h2>
        <p>Duis non leo et sapien venenatis ullamcorper. Nulla facilisi. Mauris egestas lacus risus. In non eros
            lobortis.</p>
        <form>
            <input type="email" name="email" placeholder="Enter your email" required>
        </form>
    </section>
    <footer>
        <div id="footer-id">
            <p class="copyright">Copyright 2020, tokyotours</p>
        </div>
    </footer>

</body>

</html>
              
            
!

CSS

              
                /* removing user agent stylesheet (default browser styles)*/
body, ul, li, h1, h2, a {
    margin: 0;
    padding: 0;
    font-family: Avenir, Helvetica, Arial, sans-serif;
}

header {
    background-color: burlywood;
    padding: 20px;
    text-align: center;
    position: fixed;
    width: 100%;
    z-index: 1;
    top: 0;
    left: 0;
}

header h1 {
    color: white;
    border: 8px solid #f4f4f4;
    padding: 6px 12px;
    display: inline-block;
    border-radius: 8px;
}

.banner {
    position: relative;
}

img {
    display: block;
    margin: 0 auto;
    max-height: 100vh;
    max-width: 100%;
}

.banner img{
    max-width: 100%;
}

.banner .welcome {
    background-color: bisque;
    color: brown;
    padding: 30px;
    position: absolute;
    left: 10%;
    top: 30%;
}

.banner h2 {
    font-size: 40px;
}

.banner h2 span {
    font-size: 1.3em;
}

#nav {
    background-color: #f4f4f4;
    padding: 20px;
    position: sticky;
    top: 110px;
}

nav ul {
    white-space: nowrap;
    max-width: 1200px;
    margin: 0 auto;
}

nav li a {
    text-decoration: none;
    color: black;
}

nav li {
    width: 25%;
    display: inline-block;
    font-size: 24px;
    text-align: center;
}

main {
    max-width: 100%;
    width: 1200px;
    margin: 80px auto;
    padding: 0 40px;
    box-sizing: border-box; /* padding incorporates with max-width */
}

article h2 {
    color: brown;
    font-size: 50px;
}

article p {
    line-height: 1.5em;
    color: #4b4b4b;
}

.images {
    text-align: center;
    margin: 80px 0;
    white-space: nowrap;
}

.images li {
    display: inline-block;
    width: 40%;
    margin: 20px 5%;
}

.images li img {
    max-width: 100%;
}

.join {
    background: #f4f4f4;
    text-align: center;
    padding: 60px 20px;
    color: #4b4b4b;
}

.join h2 {
    font-size-adjust: 35px;
}

form input {
    margin: 20px 0;
    padding: 10px 20px;
    font-size-adjust: 24px;
    border-radius: 8px;
    border: 4px solid white;
}

#footer-id {
    background: burlywood;
    padding: 10px;
}

footer {
    /* background: burlywood; */
    color: white;
    /* padding: 10px; */
    text-align: center;
}
              
            
!

JS

              
                
              
            
!
999px

Console