前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >flexbox简易教程

flexbox简易教程

作者头像
lilugirl
发布2020-02-18 13:24:20
7650
发布2020-02-18 13:24:20
举报
文章被收录于专栏:前端导学前端导学

实际案例 banner

代码语言:javascript
复制
<div class="banner">
    <div class="banner-content">
      <h1>Stripe</h1>
      <p>Cool payment API</p>
      <a href="#" class="btn-twitter">Start now</a>
    </div>
</div>

 <style>
    .banner {
      height: 100vh;
      color: white;
      background: linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.3) 50%),
        url('https://unsplash.it/300/250?image=0');
      background-size: cover;
      display: flex;
      justify-content: space-around;
      align-items: center;
      text-align: center;

    }

    .banner h1 {
      font-size: 50px;
      font-weight: bold;
    }

    .banner p {
      font-size: 20px;
      font-weight: lighter;
      opacity: 0.8;
      margin-bottom: 20px;
    }

   
  </style>

实际案例 tabs

代码语言:javascript
复制
  <style>
    .tabs {
      background: #534540;
      color: white;
      padding: 10px 10px 0 10px;
      display: flex;
    }

    .tabs h3 {
      font-weight: bold;
      font-size: 19px;
    }

    .tabs p {
      font-weight: lighter;
      opacity: 0.8;
    }

    .tabs-item {
      flex: 1 0 auto;
      background: #756A66;
      text-align: center;
    }

    .tabs-item:first-child {
      border-radius: 10px 0 0 0;
    }

    .tabs-item:last-child {
      border-radius: 0 10px 0 0;
    }

    .tabs-item.active {
      background-color: white;
      color: black
    }
  </style>

  <div class="tabs">
    <div class="tabs-item active">
      <h3>75</h3>
      <p>Upvoted</p>
    </div>
    <div class="tabs-item">
      <h3>75</h3>
      <p>Upvoted</p>
    </div>
    <div class="tabs-item">
      <h3>75</h3>
      <p>Upvoted</p>
    </div>
    <div class="tabs-item">
      <h3>75</h3>
      <p>Upvoted</p>
    </div>

  </div>

实际案例 product

代码语言:javascript
复制
<link href="https://cdn.bootcss.com/font-awesome/5.11.2/css/all.css" rel="stylesheet">
  <style>
    .product {
      display: flex;
      align-items: center;
      margin-bottom: 5px;
      padding: 10px;
    }

    .product:hover {
      background-color: darkkhaki;
    }

    .product-description {
      flex: 1 0 auto;
      padding: 0 10px;
    }

    .product-description h3 {
      margin-top: 0;
    }

    .product-description p {
      margin-bottom: 0;
    }

    .product-upvotes {
      text-align: center;
      padding: 10px;
    }

    .product-controls a {
      font-size: 20px;
      color: #ccc;
    }
<div class="product">
    <div class="product-upvotes">
      <i class="fa fa-caret-up"> </i>
      <p>34</p>
    </div>
    <img src="https://unsplash.it/150/100?image=0" alt="" class="product-image img-rounded">
    <div class="product-description">
      <h3>Intercom</h3>
      <p>Cool CRM Service.</p>

    </div>
    <ul class="list-inline product-controls">
      <li><a href=""><i class="fa fa-heart"></i></a></li>
      <li><a href=""><i class="fa fa-share"></i></a></li>
      <li><a href=""><i class="fa fa-star"></i></a></li>

    </ul>
  </div>
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档