html+css实现分层金字塔的实例

建站知识 2021-07-02 22:42www.168986.cn长沙网站建设

本文主要介绍了html+css实现分层金字塔的实例,分享给大家,具体如下

先上效果再看代码

直接上代码

// html 
<div class="firiangle">
  <div class="sanjiao">
   <!-- 金字塔 -->
    <div class="sj sj1"></div>
    <div class="sj sj2"></div>
    <div class="sj sj3"></div>
    <div class="sj sj4"></div>
    <div class="sj sj5"></div>
    <!-- 右侧数据填入 -->
    <div class="arow descsj1">
      <span class="line"></span>
      <span class="value" id="hgwvalue">0</span>
    </div>
    <div class="arow descsj2">
      <span class="line"></span>
      <span class="value" id="gwvalue">0</span>
    </div>
    <div class="arow descsj3">
      <span class="line"></span>
      <span class="value" id="zgwvalue">0</span>
    </div>
    <div class="arow descsj4">
      <span class="line"></span>
      <span class="value" id="zwvalue">0</span>
    </div>
    <div class="arow descsj5">
      <span class="line"></span>
      <span class="value" id="dwvalue">0</span>
    </div>
    <!-- 中间文字 -->
    <div class="describe describe1">很高危</div>
    <div class="describe describe2">高&nbsp;&nbsp;&nbsp;&nbsp;危</div>
    <div class="describe describe3">中高危</div>
    <div class="describe describe4">中&nbsp;&nbsp;&nbsp;&nbsp;危</div>
    <div class="describe describe5">低&nbsp;&nbsp;&nbsp;&nbsp;危</div>
  </div>
</div>

// css 
<style>
    body {
      width: 100%;
      height: 100%;
    }
    
    .firiangle {
      width: 300px;
      height: 200px;
      background: #082449;
    }

    .firiangle .sanjiao {
      width: 308px;
      margin: 0 auto;
      position: relative;
      transform: translateY(-50%);
      -webkit-transform: translateY(-50%);
      : 46%;
      padding-right: 30px;
    }

    .firiangle .sj {
      margin: 0 auto;
      height: 0;
      border-: 0 solid transparent;
      border-right: 15px solid transparent;
      border-left: 15px solid transparent;
      border-bottom-width: 30px;
      border-bottom-style: solid;
      box-sizing: content-box;
      margin-bottom: 9px;
    }

    .firiangle .sj1 {
      width: 0;
      border-bottom-color: #ff0086;
      box-shadow: 0 10px 0 0 #007e;
    }

    .firiangle .sj2 {
      width: 40px;
      border-bottom-color: #ff3600;
      box-shadow: 0 10px 0 0 #ce1d00;
    }

    .firiangle .sj3 {
      width: 80px;
      border-bottom-color: #ff7f00;
      box-shadow: 0 10px 0 0 #d16800;
    }

    .firiangle .sj4 {
      width: 120px;
      border-bottom-color: #ffc94d;
      box-shadow: 0 10px 0 0 #e5912e;
    }

    .firiangle .sj5 {
      width: 160px;
      border-bottom-color: #67ce67;
      box-shadow: 0 10px 0 0 #499c49;
    }

    .firiangle .arow {
      font-size: 12px;
      position: absolute;
    }

    .firiangle .line {
      display: inline-block;
      height: 1px;
      margin-bottom: 5px;
    }

    .firiangle .value {
      font-size: 16px;
    }

    .firiangle .descsj1 {
      : 5px;
      margin-left: 146px;
      color: #ff0086;
    }

    .firiangle .descsj1 .line {
      width: 100px;
      background: #ff0086;
    }

    .firiangle .descsj2 {
      : 41px;
      margin-left: 166px;
      color: #ff3600;
    }

    .firiangle .descsj2 .line {
      width: 80px;
      background: #ff3600;
    }

    .firiangle .descsj3 {
      : 81px;
      margin-left: 186px;
      color: #ff7f00;
    }

    .firiangle .descsj3 .line {
      width: 60px;
      background: #ff7f00;
    }

    .firiangle .descsj4 {
      : 119px;
      margin-left: 206px;
      color: #ffc94d;
    }

    .firiangle .descsj4 .line {
      width: 40px;
      background: #ffc94d;
    }

    .firiangle .descsj5 {
      : 159px;
      margin-left: 226px;
      color: #67ce67;
    }

    .firiangle .descsj5 .line {
      width: 20px;
      background: #67ce67;
    }

    .firiangle .describe {
      position: absolute;
      margin-left: 135px;
      font-size: 12px;
      color: #ffffff;
    }

    .firiangle .describe1 {
      : 10px;
    }

    .firiangle .describe2 {
      : 46px;
    }

    .firiangle .describe3 {
      : 86px;
    }

    .firiangle .describe4 {
      : 124px;
    }

    .firiangle .describe5 {
      : 163px;
    }
</style>

到此这篇关于html+css实现分层金字塔的实例的文章就介绍到这了,更多相关html分层金字塔内容请搜索狼蚁SEO以前的文章或继续浏览狼蚁网站SEO优化的相关文章,希望大家以后多多支持狼蚁SEO! 

Copyright © 2016-2025 www.168986.cn 狼蚁网络 版权所有 Power by