Bookmarklet to make the text between 45 and 75 characters turn red.

A Pen By Chris Coyier

Pen Settings

↑ Insert the most common viewport meta tag

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource
via CSS Lint

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource
via JS Hint

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Want a Run Button?

If active, the preview will update automatically when you change code.


              <h1>Bookmarklet to make the text between 45 and 75 characters turn red.</h1>

<p><a class="bookmarklet-link" href="javascript:(function(){function%20loadScript(a,b){var%20c=document.createElement('script');c.type='text/javascript';c.src=a;var%20d=document.getElementsByTagName('head')[0],done=false;c.onload=c.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){done=true;b()}};d.appendChild(c)}loadScript('//',function(){

var redOutline={outline:'2px solid red'},text;var textyElements='p, li, dt, dd, h1, h2, h3, h4, h5, h6';$(textyElements).on('',function(){$(this).css(redOutline)}).on('',function(){$(this).removeAttr('style')}).on('',function(){text=$(this).text();var e=text.substring(0,45);var t=text.substring(45,75);var n=text.substring(75,text.length);var r=e+'<span style=\'color: red;\'>'+t+'</span>'+n;$(this).html(r);$(textyElements).off('');$(this).removeAttr('style');})

&larr; Click that. Then hover over a text element and click that.

<p>Drag it to your Bookmarks bar to save.</p>

<p>Why? Because that's generally the ideal line length for body copy. When those characters are red you can adjust media queries and font-size and stuff until it's about right at any screen size.</p>

<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Velit amet distinctio ab minus repudiandae earum similique sapiente eos maiores illo ut veniam nisi incidunt quaerat ipsam cum ducimus animi id autem illum. Aliquid consequatur a optio illum blanditiis earum error voluptates suscipit in dignissimos facilis ab perferendis modi itaque ullam nam nostrum laborum velit vero est maiores iste quae nesciunt deserunt qui natus aut laudantium magnam neque fugiat animi accusamus eum dolorem? Accusantium earum beatae minus aspernatur recusandae enim unde qui veniam accusamus atque voluptate numquam! Dignissimos aut aspernatur quae enim ab animi deserunt possimus blanditiis cupiditate nobis incidunt velit.</p>


              /* Mobile First */
body {
  font-family: "Lucida Grande", sans-serif;
  margin: 20px auto;
  width: 95%;
  font-size: 70%;
  line-height: 1.4;
@media (min-width: 400px) {
  body { width: 90%; font-size: 75%; }
@media (min-width: 700px) {
  body { width: 80%; font-size: 90%; }
@media (min-width: 850px) {
  body { width: 70%; font-size: 100%; }
@media (min-width: 1000px) {
  body { width: 60%; font-size: 110%; }
@media (min-width: 1100px) {
  body { width: 50%; font-size: 115%;}
@media (min-width: 1450px) {
  body { width: 40%; font-size: 125%; }

p {
  margin: 0 0 1.4rem 0;

.bookmarklet-link {
  border-radius: 4px;
  background: linear-gradient(#eee, #ccc);
  padding: 5px 10px;
  border: 1px solid #999;
  color: #222;
  text-decoration: none;


Loading ..................