Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

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.

+ 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

Auto Save

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

              
                <body>
  <header id="header">
    <nav class="nav">
      <ul class="l-menu">
        <li class="nav-link"><a href="#">Link1</a></li>
        <li class="nav-link"><a href="#">Link2</a></li>
        <li class="nav-link"><a href="#">Link3</a></li>
        <li class="nav-link"><a href="#">Link4</a></li>
      </ul>
    </nav>
    <h1>
      SMACSS methodology example demo
    </h1>
  </header>
  <main id="main" class="l-column">
    <div class="l-article post">
      <article>
        <header class="post-header">
          <h2 class="post-title">Article 1</h2>
          <div class="post-author">Author 1</div>
        </header>
        <section class="post-body">
          <img class="post-image" src="https://cdn.pixabay.com/photo/2019/06/13/13/06/monster-4271569_960_720.png">
          <div class="post-content l-column">
            <p class="post-paragraph">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
            <p class="post-paragraph">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
            <button>Read more</button>
          </div>

        </section>
        <footer class="post-footer">
          Creation date: 12.09.2019
        </footer>
      </article>
    </div>
    <div class="l-article post">
      <article>
        <header class="post-header">
          <h2 class="post-title">Article 2</h2>
          <div class="post-author">Author 2</div>
        </header>
        <section class="post-body">
          <img class="post-image" src="https://cdn.pixabay.com/photo/2019/06/13/13/06/monster-4271569_960_720.png">
          <div class="post-content l-column">
            <p class="post-paragraph">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
            <p class="post-paragraph">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
            <button class="is-disabled">Read more</button>
          </div>
        </section>
        <footer class="post-footer">
          Creation date: 12.09.2019
        </footer>
      </article>
    </div>
    <div class="l-article post">
      <article>
        <header class="post-header">
          <h2 class="post-title">Article 3</h2>
          <div class="post-author">Author 3</div>
        </header>
        <section class="post-body">
          <img class="post-image" src="https://cdn.pixabay.com/photo/2019/06/13/13/06/monster-4271569_960_720.png">
          <div class="post-content l-column">
            <p class="post-paragraph">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
            <p class="post-paragraph">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
            <button class="is-disabled">Read more</button>
          </div>
        </section>
        <footer class="post-footer">
          Creation date: 12.09.2019
        </footer>
      </article>
    </div>
    <div class="l-article post">
      <article>
        <header class="post-header">
          <h2 class="post-title">Article 4</h2>
          <div class="post-author">Author 4</div>
        </header>
        <section class="post-body">
          <img class="post-image" src="https://cdn.pixabay.com/photo/2019/06/13/13/06/monster-4271569_960_720.png">
          <div class="post-content l-column">
            <p class="post-paragraph">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
            <p class="post-paragraph">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
            <button class="is-disabled">Read more</button>
          </div>
        </section>
        <footer class="post-footer">
          Creation date: 12.09.2019
        </footer>
      </article>
    </div>
  </main>
  <footer id="footer" class="l-column">
    <div class="author">
      Made with love by author
    </div>
    <nav>
      <ul class="l-menu icons">
        <li><a href="#"><img src="https://image.flaticon.com/icons/svg/23/23957.svg" class="icon"/></a></li>
                <li><a href="#"><img src="https://image.flaticon.com/icons/svg/23/23957.svg" class="icon"/></a></li>
                <li><a href="#"><img src="https://image.flaticon.com/icons/svg/23/23957.svg" class="icon"/></a></li>
      </ul>
    </nav>      

  </footer>
</body>
              
            
!

CSS

              
                
$primary: #4582E6;
$secondary: #C5C7C7;
$tertiary: #FEFFFE;
$quaternary: #2E3E3E;
$quinary: #08B2E3;

// Base styles
body {
    width: 100%;
    height: 100vh;
    margin: 0;
    padding: 0;
}

footer {
  display: flex;
}

h1 {
  font-size: 26px;
  text-align: center;
}

h2 {
  margin: 0;  
}

button {
    padding: 8px;
    border: none;
    transition: background-color 0.5s ease-out;
    cursor: pointer;
}

a {
  text-decoration: none;
}

ul {
  padding: 0;
}

li {
  list-style-type: none;
}

// Layout styles
#header, #footer {
  width: 100%;
}

#main {
  display: flex;
    margin: 10px auto;
    width: 800px;
}

.l-column {
    display: flex;
    flex-direction: column;  
}

.l-article {
    flex-grow: 1;
    display: flex;
    justify-content: space-between;
    margin: 0.25rem 0;
    border-radius: 5px;
}

.l-menu {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

// Module styles
.nav {
  padding: 5px 100px;  
}

.post {
  width: 100%;
  padding: 0.5rem;
  
  &-header {
    margin-bottom: 10px;
  }
  
  &-title {
    text-align: center;
  }
  
  &-author {
    font-size: 12px;
    text-align: center;
  }
  
  &-body {
    display: flex;
  }
  
  &-image {
    width: 200px;
  }
  
  &-content {
    margin: 0 15px;
  }
  
  &-footer {
   margin-top: 10px;
   font-size: 10px;
   justify-content: flex-end;
  }
}

.author {
  margin-top: 10px;
  text-align: center;
}

.icons {
  justify-content: center;
}

.icon {
  width: 30px;
  height: 30px;
  margin: 0 5px;
}

// State styles
.is-disabled {
  &, &:hover {
    background: $secondary;
  }
  outline: none;
  cursor: not-allowed;
}

.is-read {
  &, &:hover {
    box-shadow: 0px 0px 5px 0px $secondary !important;
    background-color: $secondary !important;
  }
}

// Theme styles
body {
  background-color: $tertiary;
  color: $quaternary;
  font-family: 'Open Sans', sans-serif;
}

a {
  color: $tertiary;
  
  &:hover {
    color: $secondary;
  }
}

button {
  background-color: $primary;
  color: $tertiary;

  &:hover {
    background-color: $quinary;
  }
}

#footer {
  background: $primary;
  box-shadow: 0px -1px 5px 0px rgba(46,62,62,0.6);
}

.nav {
  background: $primary;
  font-weight: bold;
  box-shadow: 0px 5px 5px -4px rgba(189,187,189,1);
}

.post {
  transition: box-shadow 0.1s ease-in-out;
  box-shadow: 0px 0px 5px 0px $primary;
  
  &:hover {
    box-shadow: 0px 0px 5px 2px $primary;
  }
}

.author {
  color: $tertiary;
}






              
            
!

JS

              
                document.querySelector('button').addEventListener('click', () => {
  document.querySelector('.post').classList.add('is-read')
});
              
            
!
999px

Console