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="app"></div>
              
            
!

CSS

              
                @import 'https://fonts.googleapis.com/css?family=Share+Tech+Mono';

@import 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css';

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

body {
    width: 100vw;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    background-image: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/1376484/jess-harding-lqT6NAmTaiY-unsplash.jpg'),radial-gradient(#28a3dd, #0d7751);
    background-size: cover;
    background-position: center;
    font-family: "Share Tech Mono", monospace;
    font-size: 2rem;
    background-blend-mode: multiply,screen, overlay;
}


#app {
    position: relative;
    background-size: cover;
    background-position: center;
    backdrop-filter: blur(20px);
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 5px;
    box-sizing: border-box;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    transition: .3s ease;
    margin: 2vw;
    padding: 1vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.card-header {
  display: flex;
  align-items: center;
  
  h3 {
    margin: 0;
    font-size: 6vh;
  }
  
  .crad__header--extension {
    margin-left: auto;
    color: #999;
    font-size: 4vh;
    
    &::after {
      content: "\f141";
      font-family: 'FontAwesome';
      margin-left: 5px;
    }
  }
}

.media-object {
  width: 40vh;
  margin-right: 20px;
  
  img {
    max-width: 100%;
  }
}

.media-heading {
  font-size: 5vh;
}

.media-contnt {
  font-size: 3vh;
  color: #666;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  
  .btn {
    min-width: 20vh;
    margin-left: 10px;
  }
}
              
            
!

JS

              
                const Media = ({mediaObject, mediaHeading, mediaContent}) => {
  return (
    <div className="media">
      <div className="media-object">
        <img src={mediaObject} alt={mediaHeading} />
      </div> 
      <div className="media-body">
        <h5 className="media-heading">{mediaHeading}</h5>
        <div className="media-contnt">{mediaContent}</div>  
      </div>  
    </div>
  )
}

const Button = ({buttonText, type}) => {
  return <button className={`btn btn-${type}`}>{buttonText}</button>
}



// Card
const Card = ({children}) => {
    return (
        <div className="card">{children}</div>
    )
}

// CardHeader
const CardHeader = ({children}) => {
    return (
        <div className="card-header">{children}</div>
    )
}

// CardBody
const CardBody = ({children}) => {
  return (
      <div className="card-body">{children}</div>
  )
}

// CardFooter
const CardFooter = ({children}) => {
  return (
      <div className="card-footer">{children}</div>
  )
}

const App = () => {
  return (
    <Card>
      <CardHeader>
        <h3>超级抵钱</h3>
        <div className="crad__header--extension">更多</div>
      </CardHeader>  
      <CardBody>
        <Media 
          mediaObject="//gw.alicdn.com/i1/O1CN01P2PGqg2JGVCsoEzRl_!!0-tejia.jpg_360x10000Q50.jpg" 
          mediaHeading="整箱2斤坚果巧克力威化饼"
          mediaContent="该商品参与了公益宝贝计划,卖家承诺每笔成交将为新未来高中生助学计划捐赠0.02元。"
        />
      </CardBody>
      <CardFooter>
        <Button type="outline-primary" buttonText="取消" />
        <Button type="primary" buttonText="确认" />
      </CardFooter>  
    </Card>  
  )
}

ReactDOM.render(<App />, document.getElementById('app'));
              
            
!
999px

Console