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 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

              
                <div id="cover" class="">
  <div class="cover-text">
    <h2>Different styles of Article headers are Available!</h2>
    <h4>Change the look of your block with this weird trick, the results will make you feel like a css ninja.</h4>
  </div>
  <img src='https://images.unsplash.com/photo-1509588935269-1b058d737b41?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=f79a1fd82243b784c0b8ffd78acca895' class="cover-image">
</div>

<article>
  <div id="by">
    <img src="https://static01.nyt.com/images/2017/02/14/us/14pewdiepie/14pewdiedie-thumbLarge.jpg" alt="">
    <i>By: Gloria Borger</i>
    <a href="#">Pew News</a>
    <a href="#">Meme Review</a>
  </div>
  <p>It's amazing how much  people can speak without saying anything, especialy when it comes to demos or prototypes where you really don't expect anyone to take time off their day and read.</p>
  <cite><b>" Oh wow "</b>  - Owen wilson</cite>
  <p>When it comes to it, <i>Lorem ipsum</i> placeholder text really is not the best choice for filler text because the client gets really confused and asks <i>"Why is my website in italian?"</i> then you have to explain the whole story about the printing community tradition. </p>
  <p>From all of that I bet you would not know I am really a cat, but can only write english for a short period of ti-- meow mau meow miao</p>
 
  <footer>
    <a href="#">Follow</a>
    <a href="#">Share</a>
    <a href="#">Subscribe</a>
      Smash that like button!
  </footer>
</article>

<div id="select">
  <a href="#side" class="active">Side</a>
  <a href="#top">Top</a>
  <a href="#over">Over</a>
</div>
              
            
!

CSS

              
                body{
  background:#fff;  
font-family: 'Roboto Slab', serif;
  color:#333
}
/* Default: Side heading */
#cover{
  display:flex;
  height:70vh;
  min-height:70vh;
  align-items:center;
  background:#fff;
  box-shadow:0 9px 16px -6px #0005;
  position:relative;
  overflow:hidden
}
#cover .cover-image, #cover .cover-text{
  width:50%;
  box-sizing:border-box
}
#cover .cover-image{
  object-fit:cover;
  height:100%;
  min-height:40vh
 }
#cover .cover-text{
  text-align:center;
  padding:1em
}
#cover h2{
  font-family: 'Playfair Display', serif;
  font-size:3em;
  font-weight:400;
  line-height:1em
}
#cover h4{
   font-weight:400
}
/* Top heading */

  #cover.top {
    flex-direction:column;
  }
 #cover.top .cover-text, #cover.top .cover-image{
   width:100%
  }
#cover.top .cover-image{
  height:50vh
}
#cover.top h2{
  font-size:2em
}

/* Heading Over */

#cover.over:after{
  content:"";
  display:block;
  width:100%;
  height:100%;
  background:#0004;
  position:absolute;
  z-index:1;
  top:0;
  left:0;
}
#cover.over .cover-text, #cover.over .cover-image{
  width:100%
}
#cover.over .cover-text{
  color:#fff;
  align-self:flex-end;
  position:relative;
  z-index:2
}
#cover.over .cover-image{
  position:absolute;
  z-index:0
}

@media (max-width:500px){

  #cover:not(.over) {
    flex-direction:column;
    height:fit-content
  } 
  #cover h2{
  font-size:2em
  }
  #cover .cover-text, #cover .cover-image{
   width:100%
  }
}

/* Article */

article{
  width:80vw;
  min-width:350px;
  max-width:900px;
  margin:30px auto;
  box-shadow:0 19px 16px -16px #0005;
}

#by{
  display:flex;
  align-items:center;
  margin-bottom:25px
}
#by img{
  width:40px;
  border-radius:50%;
}
#by i, #by a{
  display:inline-block;
  padding-left:10px;
  color:#999;
  font-size:0.8em
}
article p{
  line-height:1.5em;
  text-align:justify
}
article cite{
  background:#ddd;
  padding:25px 15px;
  box-sizing:border-box;
  display:block;
  width:fit-content;
  float:right;
  margin:0 0 15px 15px;
  font-family: 'Playfair Display', serif;
  font-size:0.8em
}
article cite b{
  font-size:1.6em;
  font-style:normal;
  display:block
}
article footer{
  display:block;
  border-top:1px solid #bbb;
  margin:35px 15px;
  padding:25px 5px;
  color:#666;
  font-size: 0.8em
}

article footer a{
  background:#667;
  padding:5px 10px;
  border-radius:5px;
  color:#ddd;
  text-decoration:none;
  margin-right:5px
}
article footer a:hover{
  background:#334;
}
/* Just for demo */

#select{
  position:fixed;
  right:5px;
  bottom:5px;
  background:#0006;
  padding:5px 15px;
  border-radius:5px
}
#select a{
  color:#fff;
  font-family:sans-serif;
  font-size:12px;
  text-decoration:none
}
#select .active, #select a:hover{
  text-decoration:underline
}
              
            
!

JS

              
                //JQuery not required, just for demo
$('#select a').click(function(e){
  e.preventDefault();
  let x = $(this).attr('href').replace(/#/i, "");
  $(this).addClass('active').siblings().removeClass('active');
  $('#cover').attr('class', x)
});
              
            
!
999px

Console