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 class="broadcast">
  <div class="container">📝 Help improve Affinicasts by taking a short survey. <a href="https://andyleverenz1.typeform.com/to/vdwDSK" target="_blank">Add your response</a>
  </div>

  <div class="hide-broadcast">
    <a href="#" class="hide-broadcast-target">
        <svg width="20" height="20" viewBox="0 0 20 20"><path d="M10.707 10.5l5.646-5.646a.5.5 0 0 0-.707-.707L10 9.793 4.354 4.147a.5.5 0 0 0-.707.707L9.293 10.5l-5.646 5.646a.5.5 0 0 0 .708.707l5.646-5.646 5.646 5.646a.498.498 0 0 0 .708 0 .5.5 0 0 0 0-.707L10.709 10.5z"></path></svg>
        </a>
  </div>
</div>

<div class="moar-content container">
  <p>
    Lorem ipsum dolor sit amet consectetur adipisicing elit. Maiores dolorem ea similique ullam, ipsam explicabo facere facilis, quibusdam cupiditate suscipit eaque commodi alias sint? Minus consequuntur deleniti quas quia nesciunt.
  </p>

  <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Consequatur nemo unde dignissimos dolore vitae provident optio molestiae excepturi quae fugiat nisi libero nulla, nesciunt repellat odio quia ullam? Sequi, voluptate.</p>
</div>
              
            
!

CSS

              
                 @import url('https://fonts.googleapis.com/css?family=Muli');

$brand-secondary: #F3B823;
$text-color: #444;

* {
  margin: 0; 
  padding: 0;
}

.container {
  max-width: 1170px;
  margin: 0 auto;
}

.broadcast {
  padding: .6rem 0;
  color: white;
  display: flex;
  text-align: center;
  font-family: 'Muli', sans-serif;
}

.broadcast {
  background: #444;
  position: relative;
  font-weight: bold;

  a {
    color: $brand-secondary;
    text-decoration: none;
  }

  .hide-broadcast {
    position: absolute;
    right: 20px;
    top: 3px;

    svg {
      fill: white;
      width: 20px;
      height: 20px;
      position: relative;
      top: 2px;
    }

    .hide-broadcast-target {
      width: 24px;
      height: 24px;
      display: inline-block;
      border-radius: 50%;
      padding: 4px;
      transition: all ease .3s;
    }

    &:hover {
      .hide-broadcast-target {
        background: rgba(white, .9);
        svg { fill: $text-color; }
      }
    }
  }
}

.moar-content {
  padding: 3rem 0;
  font-size: 16px;
  font-family: "Muli", sans-serif;
  
  p {
    margin-bottom: 1.6rem;
  }
}
              
            
!

JS

              
                /* Let's Build: With JavaScript - Web-Crunch.com
   Subscribe on YouTube - https://youtube.com/c/webcrunch
   
   Let's Build: Broadcast Bar with Cookie Support 
*/

var broadcast = document.querySelector('.broadcast');
var closeBroadcast = document.querySelector('.hide-broadcast-target');
var cookie = readCookie('hide_broadcast_bar');

broadcast.style.display = "none";

if (cookie == "true") {
  broadcast.style.display = "none";
}

closeBroadcast.addEventListener('click', function(e) {
  if(cookie != "true") {
    broadcast.style.display = "none";
    createCookie('hide_broadcast_bar', "true", 7);
  } 
  e.preventDefault();
});

function createCookie(name, value, days) {
  if(days) {
    var date = new Date();
    date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
    var expires = "; expires=" + date.toGMTString();
  } else var expires = "";
  document.cookie = name + "=" + value + expires + "; path=/"
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for (var i = 0; i < ca.length; i++) {
    var c = ca[i];
    while (c.charAt(0) == ' ') c = c.substring(1, c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
   
  }
  return null;
}

function eraseCookie(name) {
  createCookie(name, "", -1);
}

              
            
!
999px

Console