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.

            
              <main>
  <article id="article1">
    <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/cheesecake.jpg" alt="Photograph of a slice of cheesecake on a plate">
      <h1>Cheesecake</h1>
      <h2>Ingredients</h2>
      <h3>Crust</h3>
      <ul>
        <li>⅔ cup all-purpose flour
        <li>2 tbsp. sugar
        <li>2 tbsp. butter
        <li>1 tbsp. cold water
       </ul>
       <h3>Filling</h3>
       <ul>
         <li>4 cups fat-free cottage cheese
         <li>1½ tbsp. sugar
         <li>¼ cup all-purpose flour
       </ul>
    <button class="print">Print recipe</button>
</article>
           
<article id="article2">
  <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/brownie.jpg" alt="Photograph of a stack of zucchini brownies on a plate">
  <h1>Zucchini Brownies</h1>
  <h2>Ingredients</h2>
    <ul>
      <li>2 eggs
      <li>1 tbsp. vanilla
      <li>¾ cup brown sugar
      <li>¼ cup unsweetened applesauce
      <li>2 cups shredded zucchini
      <li>1 cup whole wheat flour
      <li>½ cup dark cocoa powder
      <li>¼ tsp. salt
      <li>1 cup carob chips
    </ul>
<button class="print">Print recipe</button>
</article>
        </main>
            
          
!
            
              @font-face {
font-family: 'Edel Sans';
src: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/edelsans.otf') format('opentype'), url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/edelsans.woff')format('woff');
font-weight: normal;
font-style: normal;
}
main { 
  display: flex;
  font-family: Edel Sans, Avenir, Arial, sans-serif; 
  margin: 0 auto;
  justify-content: center;
  max-width: 80%; 
}
article {
  margin: 0;
  position: relative;
  padding-bottom: 2rem; 
}
article img { width: 100%; height: auto; }
article h1 { line-height: 1.4; text-align: center; }
article h2 { 
  font-size: 1.4rem;
  border-bottom: 2px solid rgb(133,183,174);
  margin: 1rem auto;
  padding: .3rem; width: 8rem;
  text-align: center; font-weight: 200; 
}
article h3, article ul { margin-left: 1rem; }
article ul, article ol { 
  font-size: 1.2rem; line-height: 1.6; 
}
article ul, article ol { padding-left: 0; }
article ol { padding-left: 1rem; }
article ul { list-style-type: none;  }
article button:last-of-type { 
  position: absolute;
  bottom: 0; right: 1rem;
  padding: .5rem; 
}

@media screen and (max-width: 600px) {
	article:last-of-type { display: none; }
	article:first-of-type { width: 100%; }
}
@media print { 
	article button:last-of-type { display: none; }
}
            
          
!
            
              function removePrintStyles() {
	previousExclusions = document.getElementById("printexclusions");
	if (previousExclusions) previousExclusions.parentNode.removeChild(previousExclusions);
}

function printSection() {
	var css = document.createElement("style"),
	parentArticle = this.parentNode,
	articles = document.getElementsByTagName("article")
	css.id = "printexclusions";
	css.innerHTML += "@media print {\n"
	for (var i = 0; i < articles.length; i++) {
		if (articles[i] !== parentArticle) { css.innerHTML += "#"+articles[i].id + "{ display: none; }\n"; }
	}	
	css.innerHTML += "}\n" 
	removePrintStyles();
	document.body.appendChild(css);
	window.print();
	removePrintStyles();
}
var printRequestors = document.querySelectorAll("article button:last-of-type");
for (var i = 0; i < printRequestors.length; i++) {
	printRequestors[i].addEventListener("click", printSection, false);
}

            
          
!
999px
Loading ..................

Console