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.


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.


                <div id="container">
  <h3>Choose your text alignment</h3>
  <div id="buttons">
    <button id="left" class="active">Left</button>
    <button id="center">Center</button>
    <button id="right">Right</button>
    <button id="justify">Justify</button>
  <div id="text" style="text-align: left;">

    <p>The studio was filled with the rich odour of roses, and when the light summer wind stirred amidst the trees of the garden, there came through the open door the heavy scent of the lilac, or the more delicate perfume of the pink-flowering thorn.</p>

    <p>From the corner of the divan of Persian saddle-bags on which he was lying, smoking, as was his custom, innumerable cigarettes, Lord Henry Wotton could just catch the gleam of the honey-sweet and honey-coloured blossoms of a laburnum, whose tremulous
      branches seemed hardly able to bear the burden of a beauty so flamelike as theirs; and now and then the fantastic shadows of birds in flight flitted across the long tussore-silk curtains that were stretched in front of the huge window, producing
      a kind of momentary Japanese effect, and making him think of those pallid, jade-faced painters of Tokyo who, through the medium of an art that is necessarily immobile, seek to convey the sense of swiftness and motion. The sullen murmur of the bees
      shouldering their way through the long unmown grass, or circling with monotonous insistence round the dusty gilt horns of the straggling woodbine, seemed to make the stillness more oppressive. The dim roar of London was like the bourdon note of
      a distant organ.</p>

    <p>In the centre of the room, clamped to an upright easel, stood the full-length portrait of a young man of extraordinary personal beauty, and in front of it, some little distance away, was sitting the artist himself, Basil Hallward, whose sudden disappearance
      some years ago caused, at the time, such public excitement and gave rise to so many strange conjectures.</p>

    <p>As the painter looked at the gracious and comely form he had so skilfully mirrored in his art, a smile of pleasure passed across his face, and seemed about to linger there. But he suddenly started up, and closing his eyes, placed his fingers upon
      the lids, as though he sought to imprison within his brain some curious dream from which he feared he might awake.</p>

    <p>"It is your best work, Basil, the best thing you have ever done," said Lord Henry languidly. "You must certainly send it next year to the Grosvenor. The Academy is too large and too vulgar. Whenever I have gone there, there have been either so many
      people that I have not been able to see the pictures, which was dreadful, or so many pictures that I have not been able to see the people, which was worse. The Grosvenor is really the only place."</p>

  <p><em>The Picture of Dorian Gray</em>, by Oscar Wilde; via <a href="">via Schmoop</a></p>




html {
  margin: 0;
  padding: 0;
  background-color: #2c3a47;

#buttons {
  display: grid;
  grid-gap: 0.2em;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  grid-auto-rows: max-content;
  & button {
    color: #F8EFBA;
    background-color: #2C3A47;
    border: 0;
    padding: 0.4em 1em;
    font-size: 1em;
    cursor: pointer;
    &.active {
      background-color: #F97F51;
    &:focus {
      outline: 3px solid #D6A2E8;
    &:hover {
      opacity: 0.9;

#container {
  transition: all 300ms ease-in-out;

  margin: 1em;
  padding: 1em;

  max-width: 600px;

  background-color: #f8efba;
  color: #2c3a47;

  & p {
    font-size: 1.2em;
    font-family: sans-serif;

a {
  &:link {
    color: #1b9cfc;
  &:visited {
    color: #82589f;
  &:hover {
    color: #55e6c1;
  &:active {
    color: #f97f51;



                const buttons = $('#buttons > button');
buttons.on('click', function() {
  const id = $(this).attr('id');
  $('#text').css('text-align', id);