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

              
                <div id="rapp"></div>

              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Muli:700,400&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-size: 16px;
  font-family: 'Muli', sans-serif;
}

#rapp {
  height: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background-image: conic-gradient(from 300deg at 50% 0%, #111, 50%, #111, #444);
  background-repeat: no-repeat;
}

@media screen and (max-height: 500px) {
  body {
    height: auto;
  }
}

              
            
!

JS

              
                const { useRef, useEffect } = React

const AppWrap = styled.div`
  grid-column-start: 2;
`

const AppContainer = styled.div`
  background: conic-gradient(from -90deg at 50% 105%, white, orchid);
  border-radius: 10px;
  margin: 45px auto;
  max-width: 350px;
  padding: 95px 15px 55px 15px;
  box-shadow: 0 19px 38px rgba(126, 55, 158, .017), 0 15px 12px rgba(43, 17, 46, .19);
  position: relative;
  overflow: hidden;
`

const HeaderImage = styled.div`
  width: 100%;
  height: 175px; 
  position: absolute;
  top: 0;
  left: -10%;
  right: -10%;
  margin: 0 auto;
  z-index: 1;
  overflow: hidden;

  img {
    height: 140%;
    position: absolute;
    bottom: 0;
    margin: auto;
    object-fit: contain;
  }
`

const OverlayElm = styled.div`
  position: relative;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: linear-gradient(45deg, #e359a7, #643d80);
  background-size: cover;
  opacity: .65;
  z-index: 2;
`

const HeaderContainer = styled.header`
  display: flex;
  align-items: center;
  margin: 0 auto;
`

const ProfileImage = styled.div`
  width: 150px;
  height: 150px;
  margin: 0 auto;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  box-shadow: 0px 2px 22px 0px rgba(45, 41, 54, .55), 0px 0px 0px 4px rgba(45, 41, 54, 0.19);
  z-index: 3;

  img {
    width: 100%;
  }
`

const ContentContainer = styled.div`
  margin: 0 auto;
  text-align: center;
  color: rgb(85 65 93);

  h2 {
    margin: 35px 0 12px;
    font-size: 1.7rem;
    font-weight: 700;
  }

  h3 {
    font-size: .8rem;
    font-weight: 700;
    margin-bottom: 25px;
    text-transform: uppercase;
    
    &:after {
      content: '';
      display: block;
      width: 40px;
      height: 3px;
      background-color: #cc88cc;
      margin: 0 auto;
      position: relative;
      top: 12px;
    }
  }

  p {
    font-size: 1rem;
  }
`

const Image = () => (<>
  <HeaderImage>
    <OverlayElm />
    <img src="https://images.unsplash.com/photo-1615818499660-30bb5816e1c7" alt="header image" />
  </HeaderImage>
</>)

const App = () => {
  let app = useRef(null)
  let card = useRef(null)
  let img = useRef(null)
  let content = useRef(null)
  
  let tl = new TimelineLite()
  
  useEffect(() => {
    TweenMax.to(app, 0, {css: {visibility: 'visible'}})
    tl.from(card, 1.4, {y: 1280, ease: Power3.easeOut, scale: 0, ease: Power3.easeOut}, .2)
      .from(card.firstElementChild, 1.4, {scale: 5.5, ease: Power3.easeOut}, .4)
      .from(img.firstElementChild, 1.7, {y: -30, ease: Power3.easeOut, scale: 1.7, ease: Power3.easeOut}, .7)
      .from(content, 2, {css:{ opacity:0 }, ease:Quad.easeInOut}, .7)
  }, [])
  
  return (<>
    <AppWrap ref={el => app = el}>
      <AppContainer ref={el => card = el}>
        <Image />
        <HeaderContainer>
          <ProfileImage ref={el => img = el}>
            <img src="https://images.unsplash.com/photo-1504884790557-80daa3a9e621?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60" alt="profile image" />
          </ProfileImage>
        </HeaderContainer>
        <ContentContainer ref={el => content = el}>
          <h2>Jane Doe</h2>
          <h3>Developer</h3>
          <p>The cake is a lie.</p>
        </ContentContainer>
      </AppContainer>
    </AppWrap>
</>)
}

ReactDOM.render(<App />, document.getElementById("rapp"));

              
            
!
999px

Console