cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <head>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
</head>

<h1 class="page-title"><a href="https://abass.co/blog/it-safe-use-flexbox-calc-viewport-units" target="_blank">The Power of Flexbox, Calc, & Viewport Units</a></h1>

<!-- Example #1 - Calc & Flexbox Example-->
<p class="demo-title">Example #1: Calc & Flexbox Example</p>
<section class="social-media">
  <div>
    <a href="https://github.com/flip4bytes" class="icon--github" target="_blank"></a>
    <a href="https://twitter.com/flip4bytes" class="icon--twitter" target="_blank"></a>
    <a href="https://www.linkedin.com/in/flip4bytes" class="icon--linkedin" target="_blank"></a>
    <a href="https://www.facebook.com/flip4life" class="icon--facebook" target="_blank"></a>
    <a href="https://plus.google.com/114533524603904902096/" class="icon--google" target="_blank"></a>
    <a href="https://www.youtube.com/user/flip4bytes" class="icon--youtube" target="_blank"></a>
  </div>
</section>

<!-- Example #2 - Viewport Units & Flexbox Example -->
<p class="demo-title">Example #2: Viewport Units & Flexbox Example</p>
<section class="hero">
  <div>
    <a href="https://abass.co" target="_blank">
      <img src="https://m1.behance.net/rendition/modules/109376355/hd/059484a766e85164ceacac6d57b28894.png" alt="" />
    </a>
    <h1>This Is Using VW For Font-Size</h1>
    <h2>(fully responsive-font!)</h2>
  </div>
</section>
            
          
!
            
              // Example #1
// Using Calc & Flexbox
.social-media {
  overflow-x: hidden;
  div {
    display: flex;
    flex-wrap: wrap;
  }
  [class^=icon--] {
    flex-grow: 1;
    flex-basis: 1;
    margin: 0;
    padding: 12px 0;
    border-bottom-width: 4px;
    border-bottom-style: solid;
    font-family: FontAwesome;
    font-size: 1.6rem;
    text-align: center;
  }
  [class^=icon--]:active {
    border-width: 2px;
    padding-top: 14px;
  }
}
@media only screen and (max-width: 700px) {
  .social-media [class^=icon--] {
    flex-basis: calc(100% * 0.333333333333333);
    border-bottom: 0
  }
}
@media only screen and (max-width: 250px) {
  .social-media [class^=icon--] {
    flex-basis: calc(100% * 0.5);
  }
}


// Example #2
// Using Viewport Units & Flexbox
.hero {
  background-image: url('//i.imgur.com/plKLFPb.jpg');
  background-size: cover;
  height: 100vh;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  justify-content: center;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  text-align: center;
}
.hero img {
  border: 2px solid black;
  max-height: 30vh;
  max-width: 70vw;
}
.hero h1, h2 {
  font-size: 5vw;
  color: white;
  font-family: arial;
  text-shadow: 2px 2px 10px #000;
  margin-bottom: 0;
}
.hero h2 {
  font-size: 3vw;
  margin-top: 10px;
}

@media only screen and (max-width: 500px) {
  .hero {
    height: 65vh;
  }
}









// IGNORE BELOW
// These are just general page styling colors & icons, (HAS NO EFFECT ON PAGE LAYOUT)
.social-media .icon--github {
  color: #333;
  background-color: #525252;
  border-color: #2e2e2e;
}
.social-media .icon--github:after {
  content: '\f092';
}
.social-media .icon--twitter {
  color: #00acee;
  background-color: #18bfff;
  border-color: #009bd6;
}
.social-media .icon--twitter:after {
  content: '\f081';
}
.social-media .icon--linkedin {
  color: #1b86bc;
  background-color: #24a1e0;
  border-color: #1879a9;
}
.social-media .icon--linkedin:after {
  content: '\f08c';
}
.social-media .icon--facebook {
  color: #3b579d;
  background-color: #496abb;
  border-color: #354e8d;
}
.social-media .icon--facebook:after {
  content: '\f082';
}
.social-media .icon--google {
  color: #dd4b39;
  background-color: #e26657;
  border-color: #d63825;
}
.social-media .icon--google:after {
  content: '\f0d4';
}
.social-media .icon--youtube {
  color: #c9312c;
  background-color: #d74b46;
  border-color: #b52c28;
}
.social-media .icon--youtube:after {
  content: '\f166';
}

.page-title, .demo-title {
  background-color: tomato;
  padding: 20px;
  margin: 0;
  color: white;
  text-align: center;
  font-family: arial;
}

.demo-title {
  background-color: #333;
  margin-top: 0;
}

body {
  margin: 0
}

h1
  a
    text-decoration: none
    color: black
    &:hover
      color: white
      &:after
        display: block
        font-size: 1rem
        content: ' (Read Full Article)'
        margin-top: 10px
        color: black
            
          
!
999px
Loading ..................

Console