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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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="container">
  <div class="navigation"><ul>
  <li><a href="#">Link</a></li>
  <li><a href="#">Link</a></li>
  <li><a href="#">Link</a></li>
  <li><a href="#">Link</a></li>
</ul></div>
  <div class="content">
    <h1>WidowTamer.js</h1>
<p>Here is an example of how the WidowTamer.js plugin developed by Nathan Ford. The first paragraph under each heading is the tamed paragraph.</p>
        <h2>Padding Right</h2>
<p class="tamed padding">Esse est eu, voluptate culpa tenderloin pork loin in ad flank nostrud consequat laboris bacon ham Ut ham hock dol.</p>
<p>Esse est eu, voluptate culpa tenderloin pork loin in ad flank nostrud consequat laboris bacon ham  Ut ham hock dol.</p>
        <h2>NBSP</h2>
    <p class="tamed nbsp">Pastrami velit ea bacon, culpa deserunt in kielbasa labore meatloaf elit dolor.  Et in duis, pancetta qui boudin fugiat ea adipisicing eu meatball.  Sirloin tempor do et salami proident ex cupidatat.  Pork adipisicing.</p><p>Pastrami velit ea bacon, culpa deserunt in kielbasa labore meatloaf elit dolor.  Et in duis, pancetta qui boudin fugiat ea adipisicing eu meatball.  Sirloin tempor do et salami proident ex cupidatat.  Pork adipisicing.</p>
<h2>Word Spacing</h2>    
<p class="tamed word-spacing">Venison pastrami pancetta esse ground round occaecat shoulder tempor salami ex aliquip.  Quis pork swine jowl meatball, andouille t-bone eu short ribs pork belly.  Prosciutto drumstick quis in.  Beef ribs tri-tip cow.</p>
    <p>Venison pastrami pancetta esse ground round occaecat shoulder tempor salami ex aliquip.  Quis pork swine jowl meatball, andouille t-bone eu short ribs pork belly.  Prosciutto drumstick quis in.  Beef ribs tri-tip cow.</p>
    
</div>
  <div class="aside"> <h3>Aside Stuff</h3><ul>
  <li><a href="#">Similar Content</a></li>
  <li><a href="#">More stuff</a></li>
  <li><a href="#">other more stuff that goes on and on and on</a></li>
  <li><a href="#">more other stuff</a></li>
</ul></div>
  <div class="footer">Subscribe to <a href="http://responsivedesignweekly.com">Responsive Design Weekly</a></div>
</div>
              
            
!

CSS

              
                * { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; }

ul, li, p, html, body, h3 {
 padding: 0;
  margin: 0;
}

body {
 font-size: 16px; 
 font-family: helvetica, arial, san-serif;
 background-color: #999;
 color: #333;
}

video, embed, iframe, object, img {
  
  width: 100%;
  max-width: 100%;
  height: auto;}

h1 {
  border-top: 0.3em solid #333;
}
p {
  font-size: 1em;
  line-height:1.6em;
  margin-bottom: 2em;
}

p:first-of-type{
    margin-top: 1.6em;
}

.container {
   width: 100%;
   max-width: 64em;
  margin: 0 auto;
}

.content{
  background-color: #c84c44;
  float:left;
  width: 100%;
  padding: 5%;
}

.navigation{
  background-color: #a53d36;
  width: 100%;
  float:left;
}

.navigation ul { list-style-type: none;}

.navigation ul li {
  float:left; 
  width: 100%; 
  border-bottom: 1px solid #333; 
  height: 3em; 
  text-align: center;}
.navigation ul li a {
  line-height: 3em; 
  color: #333; 
  text-decoration: none; 
  width: 100%;
  float:left;
}

.navigation ul li:hover {
  background-color:#8e352e;
}

.aside {
  background-color: #8e352e;
  float:left;
  width: 100%;
  color: #f1f1f1;
}

.aside h3 {
  padding-left: 1.6em; 
  margin: 4em 0 0;
}
.aside ul { 
  list-style-type: none;
  margin: 1em 0 3em;
  float:left; width: 100%;
}
.aside ul li { 
  width: 100%;
  background:none; 
  border-top: 1px solid #333; 
/*  min-height: 3em; */
  padding: 0.5em 1em 1.6em; 
  text-align:left;
}
.aside ul li:last-child {
  border-bottom: none;
}
.aside ul li a {
  line-height: 1.2em; 
  color: #333; 
  text-decoration: none; 
  width: 100%;
}
.aside ul li:hover {
  background-color:#8e352e;
}

.footer{
  clear: both;
  background-color: #333333;
  width: 100%;
  height: 5em;
  float: right;
}

.footer a {
  color: #f0f0f0; 
  text-decoration: none; 
  line-height: 5em;
}
.footer a:hover {
  border-bottom: dashed 1px #999;
}


@media screen and (min-width:20em) {
 /*     20.000em /* (320 px)*/ 
   body { 
    background-color: #fff;
  }
}

@media screen and (min-width:30em) {
 /*         30.000em  /* (480 px)*/
 body { 
    background-color: #f1f1f1;
  }
}
  
@media screen and (min-width:31.25em) {
 /*     31.250em  /* (500 px)*/
  
 .navigation  ul { 
    list-style-type: none;
  }
.navigation ul li {
    float:left; 
    width: 25%;
    background:none; 
    border-right: 1px solid #333; 
    height: 3em; 
    text-align: center;
  }
  
.navigation ul li:last-child {
    border-right: none;
  }
  
.navigation ul li a {
    line-height: 3em; 
    color: #333; 
    text-decoration: none; 
    width: 100%;
    float:left;
  }
  
ul li:hover {
    background-color:#8e352e;
  }

}  
@media screen and (min-width: 37.5em) {
 /*   	37.500em  /* (600 px)*/
  
}
@media screen and (min-width:48em) {
 /*   	48.000em /*(ackkkkkk, device specific bad)768px*/
  
}
@media screen and (min-width:50em) {
 /*   	50.000em  /* (800 px)*/
  .content{
  width: 80%;
  padding: 5%;
}
  
 .aside {
   width: 20%; 
  }
  
}
@media screen and (min-width:60em) {
 /*   	60.000em /*(a designers fav)960px */
    .container {
  margin: 5em auto;
}
} 

@media screen and (min-width:64em) {
 /*   	64.000em /* (ackkkkk) 1024px */

} 
@media screen and (min-width:75em) {
 /*   	75.000em  /* (1200 px)*/
  
}  
  
  
@media screen and (min-width:87.5em) {
 /* 	87.500em  /* (1400 px)*/
/*  body {
    font-size: 1.1em;
  }*/
    
}  
  
@media screen and (min-width:100em) {
 /*   		100.000em  /* (1600 px)*/
  body {
    font-size: 1.4em;
  }
}  
  
      
  
  

		
		
		
		
		
	
	


              
            
!

JS

              
                // Widow Tamer JS by Nathan C. Ford http://artequalswork.com
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('2={u:{C:\'p,1i,1j\',v:14,6:\'1k\',D:\'1l\',O:\'1m\'},E:P 1n(),1o:4(a){3(w.1p===\'1q\')2.F(a);2.G(\'1r\',4(){2.F(a)})},F:4(a){5 m=a.6;1s(m){k\'8-Q\':k\'R\':k\'8-S\':k\'T-x\':k\'U-x\':k V:3(a.D==\'H\'&&m&&m.I(\'8\')){W.X(\'Y 6. 1t 1u 11 H 1v 8.\')}7 2.J(a);12;1w:W.X(\'Y 6. 1x 11 1y 8-Q, 8-S, T-x, 1z U-x.\')}},J:4(a){5 b=P 1A();3(a){1B(i 1C 2.u){3(a[i])b[i]=(i==\'6\'&&a[i].I(\'-\'))?2.13(a[i]):a[i];7 b[i]=2.u[i]}}7 b=2.u;3(w.15){5 d=w.15(b.C),i=0;16(i<d.K){5 t=d[i];3(t.L>2.17(t,\'1D-1E\',18)){5 e=t.1F,j=e.K-1,c=1G;16(j>=0){5 f=2.y(e[j]);3(f!=V&&f.K>b.v){c=e[j];12}j--}t.19[b.6]=\'0\';5 g=2.y(c);3(c)2.M(c,t,g,0,b)}i++}2.G(b.O,4(){2.1a(b)})}},y:4(t){l t.N||t.1b},o:4(e,t){3(e.N)e.N=t;7 e.1b=t},M:4(c,t,a,i,b){5 h=t.L;2.o(c,a.1c(0,(b.v*-1)));3(t.L<h){3(b.6==\'R\')2.o(c,2.y(c)+a.1c((b.v*-1)).q(/\\s/g,\'\\1H\'));7{5 d=(b.6.I(\'8\'))?(i/10):(i/1I);3(b.D==\'H\')d=d*-1;t.19[b.6]=d+\'1J\';2.o(c,a);2.M(c,t,a,i+1,b)}}7 2.o(c,a)},1a:4(a){5 b="\'"+a.C.q(/[^a-1d-1K-9\\-\\.]/g,\'\')+"\'";1L(2.E[b]);2.E[b]=1M(4(){2.J(a)},1N)},G:4(e,f){3(B.1e)B.1e(\'1O\'+e,f);7 B.1P(e,f,18)},13:4(s){l s.q(/-([a-1d-Z])/,4(m){l m.q(\'-\',\'\').1f()})},17:4(t,s,n){5 r;3(t.1g)r=t.1g[s.q(/-([A-z])/1Q,4(a,b){l b.1f()})];7 3(B.1h)r=w.1R.1h(t,1S).1T(s);3(n)l 1U(r);7 l r}};',62,119,'||wt|if|function|var|method|else|padding||||||||||||case|return|||settext||replace||||opts|chars|document|spacing|text|||window|elements|dir|to|init|bind|neg|match|hunter|length|offsetHeight|tamer|innerText|event|new|right|nbsp|left|word|letter|undefined|console|log|Invalid|||use|break|fixmethod||querySelectorAll|while|getstyle|true|style|onevent|textContent|slice|zA|attachEvent|toUpperCase|currentStyle|getComputedStyle|li|dd|wordSpacing|pos|orientationchange|Array|fix|readyState|complete|load|switch|You|cannot|with|default|Please|either|or|Object|for|in|line|height|childNodes|false|u00a0|100|em|Z0|clearTimeout|setTimeout|250|on|addEventListener|gi|defaultView|null|getPropertyValue|parseFloat'.split('|'),0,{}))

//if there are less than 20 characters on the last line it will add padding to the right to include more characters. This is done of page load and on resize. Notice that it only does this on paragraphs with the tamed class added.

wt.fix({
	elements: '.content  p.tamed.padding',
	chars: 20,
	method: 'padding-right',
	event: 'resize'
    });


wt.fix({
	elements: '.content  p.tamed.nbsp',
	chars: 20,
	method: 'nbsp',
	event: 'resize'
    });

wt.fix({
	elements: '.content  p.tamed.word-spacing',
	chars: 20,
	method: 'word-spacing',
	event: 'resize'
    });
              
            
!
999px

Console