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

              
                <h1 class="title">CSS Tip of the day <span>20</span></h1>

<main class="main">
  <h2>The first child pseudo-selector</h2>
  <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Beatae porro dolor commodi consequatur consectetur dolores omnis perferendis! Earum ab facilis rerum blanditiis labore? Praesentium, ea similique dolorum et harum voluptate.</p>
  <p>Excepturi, veritatis illo. Ex ducimus sapiente voluptates excepturi dignissimos nesciunt ullam, odit eius tenetur enim commodi tempore perspiciatis distinctio? Vitae nemo tenetur, rerum soluta suscipit eveniet enim facilis eius quis?</p>
  <p>Itaque at, aut non deleniti doloremque pariatur rem quam quos voluptate harum nesciunt beatae animi facere illum ex dolores quibusdam quidem iure obcaecati? Delectus minus quis dignissimos commodi. Culpa, nesciunt!</p>
  <p>Aliquam itaque perferendis possimus nisi debitis neque iste distinctio, nulla repellendus adipisci doloribus error officia ratione omnis autem iusto. Quia similique consequuntur odit iure aperiam deserunt odio laudantium vel obcaecati!</p>
</main>

<footer class="credits">
  <p>See the <a href="https://twitter.com/search?q=%23csstipoftheday&f=live" target="_blank">other tips here</a></p>
  <p>Created by <a href="https://www.kevinpowell.co" target="_blank">Kevin Powell</a></p> 
</footer>
              
            
!

CSS

              
                .main {
  font-size: 1rem;
}

.main p:first-of-type {
  font-size: 1.25rem;
}

/* =========================
   GENERAL STYLES 
   NOT RELATED TO THE TIP
============================ */

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

:root {  
  --clr-primary: #ee6352;
  --clr-secondary: #d16e8d;
  --clr-accent: #F7F7FF;
  --clr-gradient: linear-gradient(-90deg, var(--clr-primary), var(--clr-secondary));
  --ff-title: bungee, sans-serif;
  --ff-body: canada-type-gibson,sans-serif;
  --fw-body: 300;
  --fw-bold: 800;
  --fw-title: 400;
  --fw-number: 800;
}

body {
  min-height: 100vh;
  font-family: var(--ff-body);
  font-weight: var(--fw-body);
  font-size: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

a {
  color: inherit;
}

a:hover,
a:focus {
  color: var(--clr-accent);
}

:focus {
  outline: 5px solid var(--clr-accent);
  outline-offset: 3px;
}

.title,
.credits {
  text-align: center;
  text-transform: uppercase;
  padding: 1em 0 2em;
  margin: 0;
  background: var(--clr-gradient);
  position: relative;
  z-index: 1000;
}

.title {
  font-size: calc(1rem + 3vw);
  font-family: var(--ff-title);
  font-weight: var(--fw-title);
  color: white;
  text-shadow: 3px 5px 10px rgba(0,0,0, .2);
  clip-path: polygon(0 0, 100% 0%, 100% 60%, 0% 100%);
}

.title span {
    font-weight: var(--fw-number);
    color: black;
    display: inline-block;
    position: absolute;
    left: 0;
    right: 0;
    font-size: 5em;
    top: -30%;
    z-index: -1;
    opacity: .25
  }

.main {
  display: flex;
  flex-direction: column;
  width: 80%;
  max-width: 700px;
  margin: 0 auto;
  align-content: center;
  justify-content: center;
}

.credits {
  font-family: var(--ff-title);
  width: 100%;
  margin: 0;
  padding: 6em 0 1em;
  clip-path: polygon(0 60%, 100% 0, 100% 100%, 0% 100%);
  color: rgba(black, .7);
}

.credits p:last-child {
  font-size: .8em;
} 
              
            
!

JS

              
                
              
            
!
999px

Console