Pen Settings



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


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


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.


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.


                <div class="row">
   <h1>Callout Box <small>Generator tool</small></h1>

<div class="row">
    <legend>1. Select <b>the side</b> of the article the box will go on</legend>
    <input type="radio" name="float" checked="checked" value="left" id="left"/>
    <label for="left">Left</label>
    <input type="radio" name="float" value="right" id="right"/> 
    <label for="right">Right</label>
  <label for="size">2. Select <b>the size</b> the callout box</label>
  <select name="size" id="size"> 
    <option value="full">Full</option>
    <option value="wide">Wide</option>
    <option value="narrow">Narrow</option>
  <label for="headline">3. Enter <b>the headline</b> here</label>
  <input type="text" name="hText" id="headline" placeholder="Your headline here" />
  <label for="img">4. Select if there will be <b>an image</b></label>
  <select name="img" id="img">
    <option value="landscape">Landscape Image</option>
    <option value="portrait">Portrait Image</option>
    <option value="false">No Image</option>
  <p>5. Enter <b>the caption</b> here. Highlight the text to get styling options (bold, italic, numbered list, and bullet point list).</p>
  <div class="editable" id="caption"></div>

<div class="row">
   <p>You're done! Now copy the HTML code below and paste it into your website. <b>If there is an image,</b> replace the URL in the image tag (where it says src="") with your custom image url and alternative text where it says alt="".</p>
   <textarea name="code" id="code" cols="30" rows="6"><div class='callout-left full'><h3>Add your headline</h3><img src='' height='400' width='240' alt=""><p>Add your caption</p></div></textarea>

<div class="row">
  <h3>Callout Box Preview</h3> 
  <div id="preview"><div class='callout-left full'><h3>Add your headline</h3><img src='' height='400' width='240' alt=""><p>Add your caption</p></div></div>
  <p>Lorem ipsum dolor sit amet, etiam tortor adipiscing qui metus, porttitor lectus tortor dui commodo sit nec. Lacus dui dictum ut eu sapien, ligula lacinia in nulla aliquam tincidunt, amet a amet donec donec, dolor eu dui nisl. Blandit wisi risus orci metus. Feugiat interdum nunc, proin erat tortor tincidunt nec vulputate. Ipsum mi nam leo. Id et. Mauris mi vivamus malesuada, ea vitae venenatis eu porttitor. Integer at erat, sed quam ante iaculis imperdiet duis volutpat, elit suscipit facilisis gravida. Integer at ipsum nunc libero dui explicabo, facilisis condimentum porttitor tempor tristique ac nibh, vel odio duis est vivamus suspendisse qui, eget quisque. Mauris magnis, eu lacus in tempor eget inceptos luctus, turpis mauris doloribus, cras libero inceptos quam, suscipit ultrices ea. Metus nulla lorem vitae, morbi eu maecenas eget felis, urna phasellus auctor ipsum eros volutpat, in congue tellus, auctor nibh ultrices wisi. Dignissim quisque mauris. Labore ipsum pellentesque, non aliquam massa, eget amet magna vitae, mauris sem, erat velit porta vulputate at sollicitudin at. Magna duis cras imperdiet eu cursus, vel ut nam donec ac arcu ut. Diam mauris magna in eget aliquam ultrices, urna aliquet ultricies cras, eros id tellus donec, tempus magna ligula inceptos, adipiscing donec sed. Cras suspendisse augue, nam mauris turpis libero rutrum condimentum elit. Etiam tellus luctus phasellus lacus tortor metus. In hymenaeos, pede erat vitae amet, vitae senectus sed, dui risus a, eros convallis. Sed ut nulla pretium, felis nec, eget nulla ante quis a nam. Risus dui, enim consectetuer scelerisque nulla amet pellentesque tellus.Vehicula tincidunt tellus ultrices ut etiam, turpis mollis sollicitudin, dui morbi tempus litora venenatis metus etiam. Nascetur imperdiet esse, donec et fusce nec ipsum sem integer, magna mauris dolor et ad pede pede, suspendisse orci amet.Vel pretium lacinia, sit magna sed. Ipsum praesent amet sed nulla, volutpat tortor condimentum sodales interdum vel. </p>



                legend, label {
  font-size: 1em;
  line-height: 1.5;
  margin: 0.75em 0;
  font-weight: 400!important;

#caption {
  width: 100%;
  color: #8E8C87;
  background-color: #FFFFFF;
  border-style: solid;
  border-width: 1px;
  border-color: #cccccc;
  margin: 0 0 1rem 0;
  padding: 0.5em;
  min-height: 8em;
  outline: none;

#caption :first-child {
  padding-top: 0;
  margin-top: 0;


                var html1 = "<div class='callout-left ";
var html2 = "full'>";
var html3 = "<h3>Add your headline</h3>";
var html4 = "<img src='' height='400' width='235'>";
var html5 = "<p>Add your caption</p>";
var editor = new MediumEditor('.editable', {
  toolbar: {
    buttons: [

//Checks the value of the side radio and changes side
$('input:radio[name=float]').change(function() {
  var side = "";
  if(this.value == "left") side = "left ";
  else if (this.value == "right") side = "right ";
  html1 = "<div class='callout-" + side;

//Checks the value of the dropdown for size and changes the size
$('#size').val('selectedvalue').change(function() {
  if(this.value == "full") html2 = "full'>";
  else if(this.value == "wide") html2 = "wide'>";
  else if(this.value == "narrow") html2 = "narrow'>";

//Checks the headline input and changes the headline
$('#headline').bind("keyup blur paste", function() {
  var temp = $(this).val();
  if (temp == '') temp = "Add your headline";
  html3 = "<h3>" + temp + "</h3>";

//Checks the value of the img radio and adds/removes the img tag
$('#img').val('selectedvalue').change(function() {
  if(this.value == "landscape") html4 = "<img src='' height='400' width='235'>"; 
  else if(this.value == "portrait") html4 = "<img src='' height='400' width='415'>";
  else if (this.value == "false") html4 = "";

//Checks the caption input and changes the caption
editor.subscribe('editableInput', function (event, editable) {
  html5 = document.getElementById('caption').innerHTML;

//Puts all of the html together and updates the preview and result text
function endHtml() {
  var result = html1 + html2 + html3 + html4 + html5 + "</div>";