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

              
                <!------ Include the above in your HEAD tag ---------->
<div class="container">
  <div class="row">
    <div id="root"></div>
  </div>
  <div class="row">
    <div class="col-sm-6 col-md-4 col-lg-3 mt-4">
      <div class="card">
        <img class="card-img-top" src="https://picsum.photos/200/150/?random
">
          <div class="float-right m-1" style="position:absolute;right:0">
            <button type="button" class="btn btn-light m-0 text-left" style="border:#444444">
              <i class="fas fa-ellipsis-v"></i>
            </button>
          </div>
        <div class="whenhovered">
          <div class="float-right mr-0">
            <button type="button" class="btn btn-light m-0 text-left">
              MORE
              <i class="fas fa-ellipsis-v pl-2"></i>
            </button>
          </div>
          <div class="mt-5 pt-5">
            <button type="button" class="btn btn-light w-75 m-3 mt-5 text-left">
              <i class="fas fa-eye pr-2"></i>
              VIEW BOARD
            </button>
          </div>
          <div>
            <button type="button" class="btn btn-light w-75 m-3 text-left">
              <i class="fas fa-thumbtack pr-2"></i>
              PIN
            </button>
          </div>
          <div>
            <button type="button" class="btn btn-light w-75 m-3 text-left">
              <i class="fas fa-share pr-2"></i>
              SHARE
            </button>
          </div>
        </div>

        <div class="card-block">
          <h4 class="card-title">Title Text</h4>
          <div class="meta">
            <a href="#">Friends</a>
          </div>
          <div class="card-text">
            Lorem ipsum dolor sit amet, consectetur.
          </div>
        </div>
        <div class="card-footer">
          <span class="float-right">Joined in 2013</span>
          <span><i class=""></i>75 Friends</span>
        </div>
      </div>
    </div>
        <div class="col-sm-6 col-md-4 col-lg-3 mt-4">
      <div class="card">
        <img class="card-img-top" src="https://picsum.photos/200/150/?random">
        <div class="card-block">
          <h5 class="text-bold">Title Text</h5>
        </div>
        <CardHoverMenus/>
      </div>
    </div>
    <div class="col-sm-6 col-md-4 col-lg-3 mt-4">
      <div class="card">
        <img class="card-img-top" src="https://picsum.photos/200/150/?random
">
        <p class="card-block">
          Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quam velit quisquam veniam excepturi temporibus inventore corporis dicta sit culpa veritatis placeat earum, dolorum asperiores, delectus dolore voluptatibus, at magnam nobis!
        </p>
      </div>
    </div>
    <div class="col-sm-6 col-md-4 col-lg-3 mt-4">
      <div class="card">
        <img class="card-img-top" src="https://picsum.photos/200/150/?random
">
        <div class="card-block">
          <figure class="profile">
            <img src="https://picsum.photos/200/150/?random" class="profile-avatar" alt="">
          </figure>
          <h4 class="card-title mt-3">Title Text</h4>
          <div class="meta">
            <a>Friends</a>
          </div>
          <div class="card-text">
            Lorem ipsum dolor sit amet, consectetur.
          </div>
        </div>
        <div class="card-footer">
          <small>Last updated 3 mins ago</small>
          <button class="btn btn-secondary float-right btn-sm">show</button>
        </div>
      </div>
    </div>
  </div>
  <div class="row mb-5">
    <div class="col-sm-6 col-md-4 col-lg-3 mt-4">
      <div class="card card-inverse card-primary ">
        <img class="card-img-top" src="https://picsum.photos/200/150/?random">
        <blockquote class="card-blockquote p-3">
          <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat.</p>
          <footer>
            <small>
                          Someone famous in <cite title="Source Title">Source Title</cite>
                        </small>
          </footer>
        </blockquote>
      </div>
    </div>
    <div class="col-sm-6 col-md-4 col-lg-3 mt-4">
      <div class="card card-inverse card-info">
        <img class="card-img-top" src="https://picsum.photos/200/150/?random">
        <div class="card-block">
          <figure class="profile">
            <img src="https://picsum.photos/200/150/?random" class="profile-avatar" alt="">
          </figure>
          <h4 class="card-title mt-3">Title Text</h4>
          <div class="meta card-text">
            <a>Friends</a>
          </div>
          <div class="card-text">
            Lorem ipsum dolor sit amet, consectetur.
          </div>
        </div>
        <div class="card-footer">
          <small>Last updated 3 mins ago</small>
          <button class="btn btn-info float-right btn-sm">Follow</button>
        </div>
      </div>
    </div>
    <div class="col-sm-6 col-md-4 col-lg-3 mt-4">
      <div class="card card-inverse card-info">
        <img class="card-img-top" src="https://picsum.photos/200/150/?random">
        <div class="card-block">
          <figure class="profile profile-inline">
            <img src="https://picsum.photos/200/150/?random" class="profile-avatar" alt="">
          </figure>
          <h4 class="card-title">Title Text</h4>
          <div class="card-text">
            Lorem ipsum dolor sit amet, consectetur.
          </div>
        </div>
        <div class="card-footer">
          <small>Last updated 3 mins ago</small>
          <button class="btn btn-info float-right btn-sm">Follow</button>
        </div>
      </div>
    </div>
    <div class="col-sm-6 col-md-4 col-lg-3 mt-4">
      <div class="card card-inverse card-info">
        <img class="card-img-top" src="https://picsum.photos/200/150/?random">
        <div class="card-block">
          <figure class="profile profile-inline">
            <img src="https://picsum.photos/200/150/?random" class="profile-avatar" alt="">
          </figure>
          <h4 class="card-title">Title Text</h4>
          <div class="card-text">
            Lorem ipsum dolor sit amet, consectetur.
          </div>
        </div>
        <div class="card-footer">
          <button class="btn btn-info btn-sm">Follow</button>
        </div>
      </div>
    </div>
  </div>
</div>

<div class="container">
  <div class="card-deck">
    <div class="card mb-4">
      <img class="card-img-top img-fluid" src="//placehold.it/500x280" alt="Card image cap">
      <div class="card-body">
        <h4 class="card-title">1 Card title</h4>
        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
        <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
      </div>
    </div>
    <div class="card mb-4">
      <img class="card-img-top img-fluid" src="//placehold.it/500x280" alt="Card image cap">
      <div class="card-body">
        <h4 class="card-title">2 Card title</h4>
        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
        <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
      </div>
    </div>
    <div class="w-100 d-none d-sm-block d-md-none">
      <!-- wrap every 2 on sm-->
    </div>
    <div class="card mb-4">
      <img class="card-img-top img-fluid" src="//placehold.it/500x280" alt="Card image cap">
      <div class="card-body">
        <h4 class="card-title">3 Card title</h4>
        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
        <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
      </div>
    </div>
    <div class="w-100 d-none d-md-block d-lg-none">
      <!-- wrap every 3 on md-->
    </div>
    <div class="card mb-4">
      <img class="card-img-top img-fluid" src="//placehold.it/500x280" alt="Card image cap">
      <div class="card-body">
        <h4 class="card-title">4 Card title</h4>
        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
        <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
      </div>
    </div>
    <div class="w-100 d-none d-sm-block d-md-none">
      <!-- wrap every 2 on sm-->
    </div>
    <div class="w-100 d-none d-lg-block d-xl-none">
      <!-- wrap every 4 on lg-->
    </div>
    <div class="card mb-4">
      <img class="card-img-top img-fluid" src="//placehold.it/500x280" alt="Card image cap">
      <div class="card-body">
        <h4 class="card-title">5 Card title</h4>
        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
        <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
      </div>
    </div>
    <div class="w-100 d-none d-xl-block">
      <!-- wrap every 5 on xl-->
    </div>
    <div class="card mb-4">
      <img class="card-img-top img-fluid" src="//placehold.it/500x300" alt="Card image cap">
      <div class="card-body">
        <h4 class="card-title">6 Card title</h4>
        <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
        <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
      </div>
    </div>
    <div class="w-100 d-none d-sm-block d-md-none">
      <!-- wrap every 2 on sm-->
    </div>
    <div class="w-100 d-none d-md-block d-lg-none">
      <!-- wrap every 3 on md-->
    </div>
    <div class="card mb-4">
      <img class="card-img-top img-fluid" src="//placehold.it/500x270" alt="Card image cap">
      <div class="card-body">
        <h4 class="card-title">7 Card title</h4>
        <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
        <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
      </div>
    </div>
    <div class="card mb-4">
      <img class="card-img-top img-fluid" src="//placehold.it/500x300" alt="Card image cap">
      <div class="card-body">
        <h4 class="card-title">8 Card title</h4>
        <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
        <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
      </div>
    </div>
    <div class="w-100 d-none d-sm-block d-md-none">
      <!-- wrap every 2 on sm-->
    </div>
    <div class="w-100 d-none d-lg-block d-xl-none">
      <!-- wrap every 4 on lg-->
    </div>
    <div class="card mb-4">
      <img class="card-img-top img-fluid" src="//placehold.it/500x270" alt="Card image cap">
      <div class="card-body">
        <h4 class="card-title">Card title</h4>
        <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
        <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
      </div>
    </div>
    <div class="w-100 d-none d-md-block d-lg-none">
      <!-- wrap every 3 on md-->
    </div>
    <div class="card mb-4">
      <img class="card-img-top img-fluid" src="//placehold.it/500x270" alt="Card image cap">
      <div class="card-body">
        <h4 class="card-title">10 Card title</h4>
        <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.This is a wider card with supporting text below as a natural lead-in
          to additional content. This card has even longer content than the first to show that equal height action.</p>
        <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                html {
    font-family: Lato, 'Helvetica Neue', Arial, Helvetica, sans-serif;
    font-size: 14px;
}

h5 {
    font-size: 1.28571429em;
    font-weight: 700;
    line-height: 1.2857em;
    margin: 0;
}

.card {
    font-size: 1em;
    overflow: hidden;
    padding: 0;
    border: none;
    border-radius: .28571429rem;
    box-shadow: 0 1px 3px 0 #d4d4d5, 0 0 0 1px #d4d4d5;
}

.card-block {
    font-size: 1em;
    position: relative;
    margin: 0;
    padding: 1em;
    border: none;
    border-top: 1px solid rgba(34, 36, 38, .1);
    box-shadow: none;
}

.card-img-top {
    display: block;
    width: 100%;
    height: auto;
}

.card-title {
    font-size: 1.28571429em;
    font-weight: 700;
    line-height: 1.2857em;
}

.card-text {
    clear: both;
    margin-top: .5em;
    color: rgba(0, 0, 0, .68);
}

.card-footer {
    font-size: 1em;
    position: static;
    top: 0;
    left: 0;
    max-width: 100%;
    padding: .75em 1em;
    color: rgba(0, 0, 0, .4);
    border-top: 1px solid rgba(0, 0, 0, .05) !important;
    background: #fff;
}

.card-inverse .btn {
    border: 1px solid rgba(0, 0, 0, .05);
}

.profile {
    position: absolute;
    top: -12px;
    display: inline-block;
    overflow: hidden;
    box-sizing: border-box;
    width: 25px;
    height: 25px;
    margin: 0;
    border: 1px solid #fff;
    border-radius: 50%;
}

.profile-avatar {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.profile-inline {
    position: relative;
    top: 0;
    display: inline-block;
}

.profile-inline ~ .card-title {
    display: inline-block;
    margin-left: 4px;
    vertical-align: top;
}

.text-bold {
    font-weight: 700;
}

.meta {
    font-size: 1em;
    color: rgba(0, 0, 0, .4);
}

.meta a {
    text-decoration: none;
    color: rgba(0, 0, 0, .4);
}

.meta a:hover {
    color: rgba(0, 0, 0, .87);
}

.card {
    position:relative;
    overflow:hidden;
}
 
.whenhovered {
    position:absolute;
    top:-100%;
    right:0;
    background:rgba(0, 0, 0, 0);
    width:100%;
    height:100%;
    padding:2%;
    text-align:center;
    color:#fff !important;
    z-index:2;
    -webkit-transition: all 0.2s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    -ms-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;
}
.card:hover .whenhovered {
    top:0%;
    background:rgba(0, 0, 0, 0.75);
}
              
            
!

JS

              
                class CardMoreMenuBtn extends React.Component {
  render() { 
    const p = this.props;
    const clsD = (p.isRight) ? "float-right mr-0" : "";
    const clsB = (p.isRight) ? " m-0"             : " w-100 p-3";
    const clsI = (p.isRight) ? "  pl-2"           : " pr-3 pl-4";
    const iconTag = <i className={"fas fa-" + this.props.icon + clsI} />;
    return (
      <div className={clsD}>
        <button type="button" 
          className={"btn btn-light text-left " + clsB}
          onClick={this.props.clicked}>
          {p.isRight || <div>{iconTag}{p.txt}</div>}
          {p.isRight && <div>{p.txt}{iconTag}</div>}
        </button>
      </div>
  )}
}

class CardMoreMenu extends React.Component {
  render = ()=>{
    const p = this.props;
    return p.hidden ? (
      <CardMoreMenuBtn clicked={p.toggle} 
         isRight={true} 
         icon="ellipsis-v" txt="MORE" 
         />
    ) : (
      <div style={{ background: "white",maxWidth:300,float:"right" }} className="mr-1">
        <CardMoreMenuBtn clicked={p.funcs.pinAny} 
          icon="thumbtack" txt="Pin card to any board" 
          />
        <CardMoreMenuBtn clicked={p.funcs.pinHere} 
          icon="thumbs-up" txt="Pin card to this board" 
          />
        <CardMoreMenuBtn clicked={p.funcs.notInterested} 
          icon="thumbs-down" txt="Not interested in this card" 
          />
        <CardMoreMenuBtn clicked={p.funcs.shareCard} 
          icon="share" txt="Share this card" 
          />
        <CardMoreMenuBtn clicked={p.funcs.viewBoard} 
          icon="eye" txt="View board"
          />
      </div>
    );
  }
}
const CardHoverButton = (p)=>{return(
  <div>
    <button type="button" onClick={p.clicked}
      className="btn btn-light w-75 m-3 text-left">
      <i className={"fas fa-"+p.icon+" pr-2"}></i>
      {p.txt}
    </button>
  </div>
)}
const evStop = (ev)=>{
  ev.preventDefault()
  ev.stopPropagation();
  ev.nativeEvent.stopImmediatePropagation();
}
class CardHoverMenus extends React.Component {
  state = { hiddenPopupMenu: true }
  toggle = ()=>{ this.setState({ hiddenPopupMenu: ! this.state.hiddenPopupMenu }); }  clkBtn = (ev, msg) => {
    evStop(ev);
    this.props.flash(msg);
  };
  render() {
    const p = {
      funcs: {
        viewBoard: e => this.clkBtn(e, "viewBoard"),
        pinAny: e => this.clkBtn(e, "pinAny"),
        pinHere: e => this.clkBtn(e, "pinHere"),
        notInterested: e => this.clkBtn(e, "notInterested"),
        shareCard: e => this.clkBtn(e, "shareCard")
      }
    };
    //Above is hardwired for demo. Normally, const p = this.props;
    return (
    <div className="whenhovered" onClick={this.toggle}>
      <CardMoreMenu funcs={p.funcs} 
        hidden={this.state.hiddenPopupMenu} toggle={this.toggle}/>
      { this.state.hiddenPopupMenu && (
        <div>
          <div  className="mt-5 pt-5"></div>
          <div  className="mt-5"></div>
          <CardHoverButton txt="VIEW BOARD" 
            icon="eye"       clicked={p.funcs.viewBoard}/>
          <CardHoverButton txt="PIN"
            icon="thumbtack" clicked={p.funcs.pinAny}/>
          <CardHoverButton txt="SHARE"
            icon="share"     clicked={p.funcs.shareCard}/>
      </div>)}
    </div>
  )}
}

class Card extends React.Component {
  moreBtn = (        
    <div className="float-right m-1" style={{position:"absolute",right:0}}>
      <button type="button" 
        className="btn btn-light m-0 text-left"
        style={{border:"#444444"}}
        >
        <i className="fas fa-ellipsis-v" />
      </button>
    </div>
  )
  render() { return (
    /*<div className="col-sm-6 col-md-4 col-lg-3 mt-4" id={"card"+this.props.id}>*/
    <div className="col-sm-6 col-md-6 col-lg-4 mt-4">
      <div className="card">
        <img
          className="card-img-top"
          src="https://picsum.photos/200/150/?random"/>
        {this.moreBtn}
        <CardHoverMenus flash={this.props.flash}/>
        <div className="card-block">
          <h4 className="card-title">Title Text</h4>
          <div className="meta">
            <a href="#">Friends</a>
          </div>
          <div className="card-text">
            Lorem ipsum dolor sit amet, consectetur.
          </div>
        </div>
        <div className="card-footer">
          <span className="float-right">Joined in 2013</span>
          <span>
            <i className="" />75 Friends
          </span>
        </div>
      </div>
    </div>
  )}
}

class Cards extends React.Component{ 
  state={msg:null}
  flash=(m)=>{
    this.setState({msg:m})
    setTimeout(()=>{this.setState({msg:null})},2000)
  }
  render() { return(
    <div>
      <h5>{this.state.msg || "_"}</h5>
      <div className="row">
        {Array(8).fill(42).map( (x,i) => <Card key={i} flash={this.flash}/>) }
      </div>  
    </div>
  )}
}

ReactDOM.render(<Cards />, document.getElementById("root"));

              
            
!
999px

Console