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.

            
              <figure class="responsive-text-align">
  <img src="https://res.cloudinary.com/andykirk/image/upload/v1488115636/nasa/pia20512-1041x398.jpg" alt="Dione" />
  <figcaption>
    <p>
      <strong>
        Chaos at Hyperion: 
      </strong>
      The moon Hyperion tumbles as it orbits Saturn.
    </p>
    <cite>—
      <a href="https://www.nasa.gov/multimedia/imagegallery/iotd.html">NASA</a>
    </cite>
  </figcaption>
</figure>

<figure class="responsive-text-align">
  <img src="https://res.cloudinary.com/andykirk/image/upload/v1488115638/nasa/pia20700.jpg" alt="Artist’s concept shows an unusual celestial object called CX330 " />
  <figcaption>
    <p>
      <strong>
        The Loneliest Young Star: 
      </strong>
      An unusual celestial object called CX330 was first detected as a source of X-ray light in 2009. It has been launching “jets” of material into the gas and dust around it.
    </p>
    <cite>—
      <a href="https://www.nasa.gov/multimedia/imagegallery/iotd.html">NASA</a>
    </cite>
  </figcaption>
</figure>

<p>
  All credit for this idea goes to <a href="http://nocode.in/aligning-text-smartly-in-css/">Vijay Sharma: Aligning Text Smartly in CSS</a>
</p>
            
          
!
            
              /* Basic common settings: */
$primary-color: rgb(0,20,30);
$secondary-color: rgb(151, 81, 0);

*, ::before, ::after {
  box-sizing: border-box;
}

body {
  font-family: 'Lato', sans-serif;
  font-size: 0.9375rem;
  line-height: 1.4;
  padding: 1rem;
  margin: 0;
}


img {
  /* Remove whitespace under images: */
  vertical-align: middle;
  width: 100%;
}

.responsive-text-align a {
  color: $secondary-color;
  &:hover {
    color: lighten($secondary-color, 50);
  }
}

figure {
  padding: 1em;
  margin: 0 0 1em 0;
  background: #eee;
  border: 1px solid #ccc;
}

/* Double last margin prevention hack. Not intended for production. */
p:last-of-type {
  margin-bottom: 0;
}


.responsive-text-align {
  /* Cosmetics (not part of the pattern): */
  background: $primary-color;
  color: #fff;

  padding: 1em;  
  text-align: center;
}

.responsive-text-align p {
  text-align: left;
  display: inline-block;
}

.responsive-text-align cite {
  display: block;
  text-align: left;
}
            
          
!
999px
Loading ..................

Console