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

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

              
                #content
              
            
!

CSS

              
                #content {
  width: 1030px;
  margin: 0 auto;
}
.container {
  width: 1030px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-around;
}

.card-container {
  height: 334px;
  width: 334px;
  border: 1px solid #ccc;
  font-family: Helvetica;
  margin-bottom: 10px;
}

.tall-card-container {
  height: 678px;
}

.card-img {
  height: 240px;
  padding-left: 10px;
}

.card-title {
  font-weight: bold;
  line-height: 35px;
  padding-left: 10px;
  font-size: 22px;
}

.card-rating {
  height: 30px;
  background-color: #eee;
  margin-bottom: 10px;
}

.card-tomato {
  height: 20px;
  padding-left: 5px;
}

.card-rating-rotten-tomatoes {
  font-size: 13px;
  font-weight: bold;
  padding-left: 10px
}

.card-rating-liked {
  font-size: 11px;
}

.button-container {
  width: 140px;
  float: right;
  margin-right: 10px;
}

.button {
  display: block;
  line-height: 40px;
  width: 100%;
  margin-bottom: 7px;
  background-color: #ccc;
  border: none;
  font-size: 16px;
  color: #565;
  cursor: pointer;
  text-decoration: none;
}

.time-button {
  text-align: left;
  span {
    padding-left: 10px;
    
  }
}

.buy-tickets-button {
  background-color: #DE1177;
  border: none;
  position: relative;
  font-size: 13px;
  font-weight: bold;
  color: #fff;
}

.buy-tickets-image {
  height: 15px;
  position: absolute;
  left: 5px;
  top: 15px;
}

.more-sessions-button {
  text-align: center; 
}
              
            
!

JS

              
                const cards = [{
  image: "http://www.joblo.com/timthumb.php?src=/posters/images/full/the-martian-poster.jpg&h=600&q=100",
  title: "The Martian",
  rating: 86,
  description: "Mentalist gets trapped on mars and poos on potatoes to survive"
}, {
  image: "http://www.joblo.com/posters/images/full/mortdecai-munn.jpg",
  title: "Mortdecai",
  rating: 70,
  description: "Beautiful women wear convincing moustaches"
}, {
  image: "http://www.joblo.com/timthumb.php?src=/posters/images/full/AVMC_Santa_Vert_Key_Art_US_Main.jpg&h=600&q=100",
  title: "A Very Murray Christmas",
  rating: 100,
  description: "Bill Murray being a total legend"
}, {
  image: "http://www.joblo.com/posters/images/full/blood_father_poster.jpg",
  title: "Blood Father",
  rating: 60
}, {
  image: "http://www.joblo.com/timthumb.php?src=/posters/images/full/lhf-flag-poster-gallery.jpg&h=600&q=100",
  title: "London has Falling",
  rating: 50
}, {
  image: "http://www.joblo.com/timthumb.php?src=/posters/images/full/pride_and_prejudice_and_zombies_poster2.jpg&h=600&q=100",
  title: "Pride and Prejudice Zombies",
  rating: 50
}, {
  image: "http://www.joblo.com/timthumb.php?src=/posters/images/full/the-purge-ey-mposters-02-gallery.jpg&h=600&q=100",
  title: "The Purge",
  rating: 76
}, {
  image: "http://www.joblo.com/timthumb.php?src=/posters/images/full/sausage-party-poster1.jpg&h=600&q=100",
  title: "Sausage Party",
  rating: 99
}, {
  image: "http://www.joblo.com/timthumb.php?src=/posters/images/full/kung-fu-panda-3-poster-full.jpg&h=600&q=100",
  title: "Kung Fu Panda 3",
  rating: 99
}]

function TomatoRating(props) {
  const { rating } = props;
  return (
    <div className="card-rating">
        <img className="card-tomato" src="https://d2a5cgar23scu2.cloudfront.net/static/images/icons/fresh-16.png" />
        <span className="card-rating-rotten-tomatoes">
          ROTTEN TOMATOES SCORE - 
          <span className="card-rating-liked"> {rating}% liked it</span>
        </span>
    </div>
  );
}

function BuyTickets() {
  return (
    <button className="button buy-tickets-button">
      <img className="buy-tickets-image" src="http://www.iconsplace.com/icons/preview/white/ticket-256.png" />
      BUY TICKETS
    </button>
  )
}

function TimeButton(props) {
  const { time, url } = props;
  return (
    <a className="button time-button" href={url}><span>{time}</span></a>
  );
}

function MoreSessions(props) {
  const url = props;
  return (
    <a className="button more-sessions-button" href={url}>More Sessions ></a>
  )
}


function Card(props) {
  const { image, title, rating, description, tallCard } = props;
  const className = tallCard ? "card-container tall-card-container" : "card-container";
  return (
    <div className={className}>
      <div className="card-title">{title}</div>
      
      <TomatoRating rating={rating} /> 
      <img className="card-img" src={image} />
      <div className="button-container">
        <BuyTickets />
        <TimeButton time="6:45pm" /> 
        <TimeButton time="7:45pm" />  
        <TimeButton time="8:45pm" />  
        <MoreSessions url="https://thefix.nine.com.au" />
      </div>
    </div>
  );
}


function Cards() {
  return (
    <div className="container">
      {cards.map(card => Card(card))}
    </div>
  );
}


ReactDOM.render(<Cards />, document.getElementById('content'))
              
            
!
999px

Console