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

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

              
                <link href='https://fonts.googleapis.com/css?family=Open+Sans:700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Lora' rel='stylesheet' type='text/css'>

<div class="contain-demo">
  <header>
    <!-- This is a broken image, yet we don't see that pesky broken img link visual...check out the JS -->
    <img src="don't worry, broken on purpose" alt="Intentionally broken image link" />
    <img class="glove" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/80625/boxleft.svg" alt="illustrated salmon colored boxing glove" />
    <h1 class="title">Boxing Classes</h1>
    <img class="glove" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/80625/boxright.svg" alt="illustrated salmon colored boxing glove" />
    <h2 class="sub-title">...the fake kind for demo purposes.</h2>   
  </header>
  
  <main>
    
    <section class="contain-form">
      <!-- hook for form trigger -->
      <button class="form-title">
        Sign Up
      </button>
      <div class="form">
        <form class="signup-form" action="demo_form.asp" method="get">
          <div>
            <label for="name">Name:</label>
            <input type="text" name="name">
          </div>
          <div>
            <label for="datetime">Time:</label>
            <input type="datetime" name="datetime">
          </div>
          <div>
            <label for="email">Email:</label>
            <input type="email" name="email">
          </div>
          <div>
            <button type="submit" class="submit">Submit
            </button>
          </div>
        </form>
      </div>
    </section>
    
    <section>
      <div class="benefits">
        <div class="benefits-intro">Benefits of boxing: </div>
        <div class="contain-list">
          <ul id="cyclelist">
            <li>Wear giant mittens.</li>
            <li>Fight crime.</li>
            <li>Hulk smash.</li>
          <ul>
        </div>
      </div>
    </section>
   
    <section class="contain-details">
        
      <div class="details">
        <h3>A Little About Us</h3>
        <p>A secret was indebted to communism. “I'll be alright,” huffed Gwen Dawson. The war introduced some fresh air. Her majesty looked up to England. “Cheer up, Carson. There are worse things happening in the world,” grumbled Miss Patmore.</p>
        <p>“What should we call each other,” huffed Mrs. Bird. The maid disavowed an Englishman. “In this case Mary has the trump card,” mumbled Sir Richard Carlisle. “Oh yes. Something will turn up,” chattered Miss Robinson. Miss Patmore screamed, “Stop right there! If you want to ...[can't make out this bit]... offer the doctor some whisky.”</p>
        <p>“There's nothing we can do about the title,” proclaimed Major Gordon. The maid summoned the valet. Mr. Tom Branson observed, “You and my parents have something in common.” “What do you mean,” grumbled Mr. Barrow. Elsie Hughes yelled, “She was very upset by the death of poor Mr Pamuk.”</p>
      </div>
      <div class="details">
        <h3>People Are Saying</h3>
        <p>Her majesty cured the war. The housemaid engaged a cane. “Well what do you mean,” whispered The Honorable Evelyn Napier. The maid hit Christmas. Lady Crawley shared, “But you were sure. Shall I tell you what I think has altered you - my prospects! Because nothing else has changed.”</p>
        <p>“So, do we break a patient's confidence and disobey her orders or not,” informed Mrs. Crawley. “What, all three of them?! I'm not an octopus. Why can't Gwen do it,” bloviated Mr. Gregson. Major Gordon bloviated, “It's unusual, obviously.” An American had improper relations with England. William Mason yelped, “She'd never throw him over.”</p>
        <p>Scotland enjoyed London. “I doubt cousin Mary and I are destined to be close friends. I don't blame her. Her father's home and her mother's fortune are to be passed to me. It's very harsh,” cried The Right Honourable Cora, Countess of Grantham. Mrs. Bryant said, “No, and he isn't going to.” Mr. Mason chattered, “Even Thomas? Even after what they tried to do to you?” Lieutenant Edward Courtenay had an American.</p>
      </div>
    </section>
        
    <section class="get-more">
      <div class="contain-newsletter">
        <form class="newsletter-form" action="demo_form.asp" method="get">
          <input class="news-input" id="news-input" type="email" name="email" value="[email protected]"><br>
          <button type="submit newsletter-submit" class="submit get-newsletter">Get Newsletter!</button>
        </form>
      </div>
    </section>
      
  </main>
    
  <footer>
    <p>This odd demo was created w&#47;<br> hearts &#38; enthusiasm by <a href="http://jonibologna.com/">Joni Bologna</a></p>
  </footer>  
    
</div>
              
            
!

CSS

              
                @import "compass/css3";

$main-background: #f9f9f9;
$header-background: #826773;
$title-font: 'Open Sans', sans-serif;
$title-color: #ff7f77;
$subtitle-color: #d3bec7;
$detail-background: $main-background;
$detail-color: #333333;

html {
  font-size: 16px;
}

body {
  background: $main-background;
}

// header
header {
  padding: 1.6rem 0 3rem 0;
  background: $header-background;
  border-bottom: .5rem solid $title-color;
  text-align: center;
}

.title {
  margin-bottom: 0;
  display: inline-block;
  color: $title-color;
  font-family: $title-font;
  font-size: 2.1rem;
}

.sub-title {
  color: $subtitle-color;
  font-size: .9rem;
}

.glove {
  display: none;
}

// form
.signup-form {
  margin: 30px auto;
  padding: .7rem;
  display: none;
  color: #333333;
  background: $title-color;
  border-radius: 5px;
  width: 280px;
}

.signup-form input {
  border-radius: 4px;
}

.submit {
  padding: .2rem .5rem;
  background: $header-background;
  border: none;
  border-radius: 2px;
  color: $main-background;
}

.contain-form {
  padding: 1.5rem 0;
  text-align: center;
  background: $subtitle-color;
}

.form-title {
  margin: 0 auto;
  padding: .3rem .5rem;
  background: $header-background;
  color: white;
  font-family: $title-font;
  border: none;
  border-radius: .1rem;
  width: 6rem;
}

.form div {
  padding: 10px;
}

.signup-form label {
  display: inline-block;
  width: 45px;
  font-size: 16px;
  text-align: right;
}

// Benefits list
.benefits {
  margin: 70px auto 30px;
  border: 8px solid $subtitle-color;
  color: $header-background;
  font-size: 1.2rem;
  text-align: center;
  border-radius: 5px;
  width: 250px;
  height: 120px;
  overflow: hidden;
}

.benefits-intro {
  background: $subtitle-color;
  color: white;
}

.benefits div {
  padding: 15px 0;
  width: 250px;
}

ul {
  position: relative;
  margin: 0;
  padding: 0;
  list-style-type: none;
}

ul li {
  position: absolute;
  padding-top: 7px;
  // do this to prevent ugly mess:
  opacity: 0;
  width: 250px;
}

// Content 
h3 {
  text-align: center;
  color: $title-color;
}

.details {
  padding: 1.5rem;
  background: $detail-background;
}

.details p {
  color: $detail-color;
  font-family: 'Lora', serif;
  font-size: .9rem;
}

// Newsletter
.get-more {
  padding: 50px;
  background: $subtitle-color;
}

.contain-newsletter {
  position: relative;
  text-align: center;
  font-size: .9rem;
}

.newsletter-form input {
  padding: 5px;
  border-radius: 3px;
  color: #c1c1c1;
}

.newsletter-form .submit {
  margin: 20px 0 10px 0;
  padding: .4rem .5rem .2rem;
}

.news-input.is-active {
  background: #41c44e;
}

// Footer 
footer {
  padding: .3rem;
  background: $header-background;
  text-align: center;
  font-size: .7rem;
  color: $subtitle-color;
  height: 60px;
}

footer a {
  color: $title-color;
  text-decoration: none;
}

@media (min-width: 600px) {
  html {
    font-size: 19px;
  }
  .glove {
    display: inline-block;
  }
  .contain-details {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
  }
  .details {
    width: 40%;
  }
}
              
            
!

JS

              
                /* 
Demo for a blog post:
http://jonibologna.com/jquery-snippet-heavy-hitters/
*/ 

// Hide broken images!
$("img").error(function(){
        $(this).hide();
});

// Show/Hide
$(".form-title").click(function() {
  $(".signup-form").toggle();
});

/* Cycle through list: https://css-tricks.com/snippets/jquery/cycle-through-a-list/ */
$(document).ready(function() {

	 var j = 0;
	 var delay = 2000; 
	 function cycleThru(){
     var jmax = $("ul#cyclelist li").length -1;
     $("ul#cyclelist li:eq(" + j + ")")
     .animate({"opacity" : "1"}, 400)
     .animate({"opacity" : "1"}, delay)
     .animate({"opacity" : "0"}, 400, function(){
       (j == jmax) ? j=0 : j++;
       cycleThru();
     });
   };

	 cycleThru();

 });

// Toggle class
$('.get-newsletter').on('click', function(evt) {
  // prevent default actions
  evt.preventDefault();
  
  $('.news-input').toggleClass('is-active');
  
  /* Don't mind me, just changes the value text */
  document.getElementById('news-input').value= "It's on the way!";
});


              
            
!
999px

Console