cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              html {
  height: 100%;
}

body {
  height: 100%;
  font-family: 'Roboto', sans-serif;
  margin: 0;
}

#root {
  height: 100%;
}

.container {
  height: 100%;
}

nav {
  width: 100%;
  position: fixed;
  background-color: rgba(255,255,255,0.65);
  z-index: 1;
}

.avatar {
  width: 10px;
  height: 10px;
  display:inline-block;
  border-radius: 50%;
  overflow: hidden;
  margin-top: 8px;
}

main {
  height: 100%;
}

ul {
  list-style-type: none;
  overflow: hidden;
  margin: 0;
  padding: 0 1rem;
  li {
  float: left;
    a {
      display:block;
      color: grey;
      text-align:center;
      padding: 14px 16px;
      text-decoration:none;
    }
}
}

.search {
  color: transparent;
  text-shadow: 0 0 0 lightgrey;
  background: none;
  border: none;
}

li a:not(.active):hover {
  color: red;
}

.navbar__brand {
  color: red;
  font-weight: bold;
}
.navbar__avatar {
  display:table-cell;
  height: 100%;
}
// .navbar__link:not(.active):hover {
//   border-bottom: 0.25rem solid red;
// }

.navbar__form {
  input {
background:none;
  border: 2px solid lightgrey;
  border-radius: 1rem;
    padding: .5rem;
  }
}

input:focus{
  outline:none;
}

.main-product {
  background-image: url('https://image.tmdb.org/t/p/original/zfWPeRgYpRjPZLGwwkfnTfaFnNh.jpg');
  height: 60%;
   background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.secondary-products {
  height: 40%;
}

.product__details {
    bottom: 1rem;
    position: absolute;
    left: 2rem;
}

.product__details--secondary {
  position: absolute;
  bottom: 0;
  left: 1rem;
  font-size: .75rem;
}
.product__title {
    color: white;
    font-size: 2rem;
    position: absolute;
    bottom: 4rem;
    left: 2rem;
}
.product__title--secondary {
  color: #fff;
  font-size: 1rem;
  position: absolute;
  bottom: 3rem;
  left: 1rem;
}

.active {
  color: red;
  border-bottom: 0.25rem solid red;
}

.horizontal {
  display: inline;
}
.genres{
  color: white;
  display:inline-block;
  margin: 1rem 0;
}
.label {
  display:inline-block;
  width: auto;
  color: white;
  padding: 0.25rem;
  margin: 0 1rem;
      background-color:green;
}

.label-green {
    background-color:#0dfb5a;
}

.label-red {
    background-color:#fb0d26;
}
.label-blue {
      background-color:#0d59fb;
}
.genres-secondary{
  color: white;
  display:inline-block;
  margin: 1rem 0;
}
.label-secondary {
  display:inline-block;
  width: auto;
  color: white;
  padding: 0.25rem;
  margin: 1rem;
  background-color:red; 
}
.gradient-primary {
    width: 100%;
    position: absolute;
    height: 60%;
    top: 0px;
    left: 0;
    background: -moz-linear-gradient(top,  rgba(0,0,0,0) 50%, rgba(0,0,0,1) 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(50%,rgba(0,0,0,0)), color-stop(100%,rgba(0,0,0,1))); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top,  rgba(0,0,0,0) 50%,rgba(0,0,0,1) 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  rgba(0,0,0,0) 50%,rgba(0,0,0,1) 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  rgba(0,0,0,0) 50%,rgba(0,0,0,1) 100%); /* IE10+ */
    background: linear-gradient(to bottom,  rgba(51, 51, 51, 0) 50%,rgba(0,0,0,1) 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', endColorstr='#000000',GradientType=0 ); /* IE6-9 */
}

.gradient-secondary {
    width: 33.33%;
    position: absolute;
    height: 40%;
    bottom: 0px;
    background: -moz-linear-gradient(top,  rgba(0,0,0,0) 50%, rgba(0,0,0,1) 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(50%,rgba(0,0,0,0)), color-stop(100%,rgba(0,0,0,1))); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top,  rgba(0,0,0,0) 50%,rgba(0,0,0,1) 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  rgba(0,0,0,0) 50%,rgba(0,0,0,1) 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  rgba(0,0,0,0) 50%,rgba(0,0,0,1) 100%); /* IE10+ */
    background: linear-gradient(to bottom,  rgba(51, 51, 51, 0) 50%,rgba(0,0,0,1) 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', endColorstr='#000000',GradientType=0 ); /* IE6-9 */
}

// Grid
.flex-grid {
  display:flex;
}

.col {
  flex: 1;
}

@media (max-width: 768px) {
  .flex-grid {
    display:block;
    .col {
      height: 100%;
    }
  }
  .gradient-secondary {
    width: 100%;
    bottom: inherit;
  }
}
            
          
!
            
              (function() {
  const { h, render, Component } = preact;
  /** @jsx h */

  const avatarStyle = {
    backgroundImage: `url(${"https://images.unsplash.com/photo-1499155286265-79a9dc9c6380?auto=format&fit=crop&w=331&q=80"})`,
    backgroundSize: "cover",
    backgroundPosition: "top center"
  };
  const Navigation = () => {
    return (
      <nav className="navbar">
        <ul className="link-list">
          <li href="#" style="float:left">
            <a className="navbar__brand" href="#">
              ACME Films
            </a>
          </li>
          <li className="navbar__link" href="#">
            <a href="#" className="active">
              Explore
            </a>
          </li>
          <li className="navbar__link" href="#">
            <a href="#">Movies</a>
          </li>
          <li className="navbar__link" href="#">
            <a href="#">TV Shows</a>
          </li>
          <li className="navbar__avatar" href="#" style="float:right">
            <a className="avatar" href="#" style={avatarStyle} />
          </li>
        </ul>
      </nav>
    );
  };
  const MainProduct = ({ product }) => {
    return (
      <section className="main-product">
        <div className="gradient-primary">
          <div className="product__title">{product.title}</div>
          <div className="product__details">
            <div className="genres">{product.genres.join(", ")}</div>
            <div className="label label-green">{product.tag}</div>
          </div>
        </div>
      </section>
    );
  };
  const SecondaryProducts = ({ products }) => {
    return (
      <section className="flex-grid secondary-products">
        {products.map((e, i) => {
          return (
            <div className={"col" + " product-" + (i + 1)}>
              <div
                className="gradient-secondary"
                style={{
                  backgroundImage: `url(${e.background})`,
                  backgroundSize: "cover",
                  backgroundRepeat: "no-repeat",
                  backgroundPosition: "center"
                }}
              >
                <div className="product__title--secondary">{e.title}</div>
                <div className="product__details--secondary">
                  <div className="genres">{e.genres.join(", ")}</div>
                  {e.tag && <div className={"label "+'label-'+(e.tag=='TRENDING'?'blue':'red')}>{e.tag}</div>}
                </div>
              </div>
            </div>
          );
        })}
      </section>
    );
  };

  class Home extends Component {
    constructor() {
      super();
      this.state = {
        featuredProd: {
          title: "Blade Runner 2049",
          genres: ["Mystery", "Science Fiction", "Thriller"],
          background:
            "https://image.tmdb.org/t/p/original/zfWPeRgYpRjPZLGwwkfnTfaFnNh.jpg",
          tag: "NEW"
        },
        secondaryProducts: [
          {
            title: "Interstellar",
            genres: ["Science Fiction", "Adventure"],
            tag: "POPULAR",
            background:
              "https://www.cinematographe.it/wp-content/uploads/2016/02/interstellar.jpg"
          },
          {
            title: "Metropolis",
            genres: ["Science Fiction"],
            tag: "",
            background:
              "https://images-na.ssl-images-amazon.com/images/M/MV5BMTcyNTIxNzEwM15BMl5BanBnXkFtZTgwODY1MTEwMzE@._V1_.jpg"
          },
          {
            title: "2001: A Space Odyssey",
            genres: ["Science Fiction", "Mystery"],
            tag: "TRENDING",
            background:
              "https://image.tmdb.org/t/p/original/8mba5fmnr2PNyJqfqFNGmCzhCgi.jpg"
          }
        ]
      };
    }
    render() {
      const { featuredProd, secondaryProducts } = this.state;
      return (
        <div className="container">
          <Navigation />
          <main>
            <MainProduct product={featuredProd} />
            <SecondaryProducts products={secondaryProducts} />
          </main>
        </div>
      );
    }
  }
  render(<Home />, document.getElementById("root"));
})();

            
          
!
999px
Loading ..................

Console