Pen Settings

HTML

CSS

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.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

HTML

              
                <html lang="es">
<head>
  <meta charset="UTF-8">
  <title>HTML5 básico con FlexBox</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>

  <main>
    <header><h1>Cabecera (header)</h1></header>    
    <nav>
      <div class="menu">ítem 1</div>
      <div class="menu">ítem 2</div>
      <div class="menu">ítem 3</div>
    </nav>
    <section>
      <article><h2>Artículo 1</h2>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sit obcaecati quidem et temporibus sequi nesciunt neque, odio earum, provident architecto voluptate fuga quod ut vero asperiores magnam excepturi nihil molestiae.</article>
      <article><h2>Artículo 2</h2>
      In autem molestiae, voluptatem ratione omnis rerum dolorem deleniti porro? Repudiandae, pariatur dolorum doloribus a quibusdam, autem porro dignissimos quaerat illum magnam, at perspiciatis! Quasi quas praesentium nisi, nesciunt officia.</article>
      <article><h2>Artículo 3</h2>
      Dignissimos expedita necessitatibus eius! Suscipit quo delectus ratione possimus sit nihil distinctio saepe expedita rerum voluptates dolorem adipisci atque accusamus quisquam commodi ut, eligendi aliquam molestiae nobis ex? Aliquam, consequatur!</article>
      <article><h2>Artículo 4</h2>
      Dignissimos expedita necessitatibus eius! Suscipit quo delectus ratione possimus sit nihil distinctio saepe expedita rerum voluptates dolorem adipisci atque accusamus quisquam commodi ut, eligendi aliquam molestiae nobis ex? Aliquam, consequatur!</article>
    </section>
    <aside>
      <h3>Barra lateral (aside)</h3>
      <p>Voluptatibus minima quod tenetur fugiat atque nisi ex necessitatibus est. Incidunt facilis quis voluptate repellat eveniet, iure quae! Optio, hic!</p>
    </aside>
    <footer><h5>Pie de página (footer)</h5></footer>

  </main>
</body>
</html>
              
            
!

CSS

              
                /*  ===================================
      Responsive Design, Mobile-First
      (cc) 3con14.pro
    =================================== */

/* Reglas comunes ------------------------------- */
* {
  margin     : 0;
  padding    : 0;
  box-sizing : border-box;
  transition : all 0.5s ease-out;
}
body {
  font       : 16px sans-serif;
  background : rgba(0,0,128,0.2);
  padding    : 1rem;
}
main,header,nav,section,article,aside,footer {
  outline    : 1px solid #fff;
  background : rgba(0,0,0,0.1);
}
header,nav,article,aside,footer {
  padding: 1rem;
}
section { background: rgba(255,0,0,0.1); }
aside   { background: rgba(255,255,0,0.1); }


/* Smartphone ----------------------------------- */
main {
  display        : flex;
  flex-direction : row;
  flex-wrap      : wrap;
}
nav {
  display        : flex;
  flex-direction : column;
}
.menu {
  background : rgba(0,0,255,0.2);
  margin     : 1px;
  padding    : 2px 1em;
  text-align : center;
}
header,nav,section,aside,footer {
  width: 100%;
}


/* Tablet --------------------------------------- */
@media all and (min-width: 568px) {
  section { flex: 3; order: 2; }
  aside { flex: 1; order: 1; }
  footer { order: 3; }
  nav { 
    flex-direction  : row;
    justify-content : flex-end;
  }
}
/* Desktop -------------------------------------- */
@media all and (min-width: 768px) {
  section {
    display   : flex;
    flex-wrap : wrap;
    order: 1;
  }
  article { width: 50%; }
  nav     { justify-content: center; }
}

              
            
!

JS

              
                
              
            
!
999px

Console