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

Auto Save

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

              
                <h1 class="py-3">Test of a responsive image placeholder for HTML wireframing </h1>
<p>
  <a href="https://codepen.io/agibdk/pen/zJxzWQ">Image placeholder</a> in HTML/CSS without images or JavaScript. Created with ideas from <a href="https://codepen.io/juicypixels/pen/gPravL">Juicy Pixels</a>.
</p>
<p>
  Accompanying <a href="http://agib.dk/posts/2018/responsive-image-placeholder-for-html-wireframes.html">blog post</a>.</p>

<hr>

<div class="container-fluid">
  <div class="agibdk-image-placeholder h-14r" data-text="Services illustration header image"></div>
  <h2 class="text-center font-weight-bold py-5">Services</h2>
  <div class="row">
    <div class="col-md mb-5">
      <div class="agibdk-image-placeholder h-10r" data-text="Illustration of responsive design"></div>
       <h4 class="py-3">Responsive design</h4>
      <p>A very brief description of what it is how it benefits the client's business.</p>
      <a href="#" class="btn btn-block btn-primary">Responsive design &rarr;</a>
    </div>
    <div class="col-md mb-5">
      <div class="agibdk-image-placeholder h-10r" data-text="Illustration of expert reviews"></div>
       <h4 class="py-3">Expert reviews</h4>
      <p>A very brief description of what it is how it benefits the client's business.</p>
      <a href="#" class="btn btn-block btn-primary">Expert reviews &rarr;</a>
    </div>
    <div class="col-md mb-5">
      <div class="agibdk-image-placeholder h-10r" data-text="Illustration of prototyping"></div>
      <h4 class="py-3">Prototyping</h4>
      <p>A very brief description of what it is how it benefits the client's business.</p>
      <a href="#" class="btn btn-block btn-primary">Prototyping &rarr;</a>
    </div>
  </div>
</div>

<hr>
<div class="container-fluid">
  <h2 class="text-center font-weight-bold py-5">Cases</h2>
  <div class="row">
    <div class="col-md-7 mb-5">
      <div class="agibdk-image-placeholder h-14r" data-text="Illustration of case"></div>
       <h4 class="py-3">Case heading</h4>
      <p>Here goes an interesting teaser for the case, prompting users to learn more.</p>
      <a href="#" class="btn btn-outline-primary">More &rarr;</a>
    </div>
    <div class="col-md mb-5">
      <div class="agibdk-image-placeholder h-14r" data-text="Illustration of case"></div>
       <h4 class="py-3">Case heading</h4>
      <p>Here goes an interesting teaser for the case, prompting users to learn more.</p>
      <a href="#" class="btn btn-outline-primary">More &rarr;</a>
    </div>
  </div>
  <div class="row">
    <div class="col-md-5 mb-5">
      <div class="agibdk-image-placeholder h-14r" data-text="Illustration of case"></div>
       <h4 class="py-3">Case heading</h4>
      <p>Here goes an interesting teaser for the case, prompting users to learn more.</p>
      <a href="#" class="btn btn-outline-primary">More &rarr;</a>
    </div>
    <div class="col-md mb-5">
      <div class="agibdk-image-placeholder h-14r" data-text="Illustration of case"></div>
       <h4 class="py-3">Case heading</h4>
      <p>Here goes an interesting teaser for the case, prompting users to learn more.</p>
      <a href="#" class="btn btn-outline-primary">More &rarr;</a>
    </div>
  </div>
</div>
<hr>

 
              
            
!

CSS

              
                @border-color: #aaa;
@placeholder-text-padding: .25rem;
@placeholder-text-bg: white;
@bg-pos-offset: -3px;

body {
  padding: 1rem;
  font-family: sans-serif;
}

.h-10r {
  height: 10rem;
}
.h-14r {
  height: 14rem;
}


.container {
    width: 70%;
}


.agibdk-image-placeholder {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  text-align: center;
  outline: 1px solid @border-color;
  background: linear-gradient(to top right, transparent 50%, @border-color, transparent 51%);
  background-color: #ddd;
  background-position-x: @bg-pos-offset;
  &::before {
    display: inline-block;
    content: attr(data-text);
    background-color: @placeholder-text-bg;
    padding: @placeholder-text-padding;
    z-index: 10;
  }
  &::after {
    content: "";
    display: block;
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom right, transparent 50%, @border-color, transparent 51%);
    background-position-x: @bg-pos-offset;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console