前端代码片段总结——统计数字展示栏

分类:计算机 | 前端 | 综合 63
更新:2021-11-13 19:17:42
编辑

1 效果图

2 代码

html代码:

  <div class="statistics_body">
    <!-- 文章总数 -->
    <div class="div_articlecount">
      <div class="div_articlecount_top">
        <span id="articleCount">111</span>
        <span id="articleUnit">篇</span>
      </div>

      <div class="div_articlecount_bottom">文章总数</div>
    </div>

    <!-- 今日访问量统计 -->
    <div class="div_todayvisitcount">
      <div class="div_articlecount_top">
        <span id="articleCount">10000</span>
        <span id="articleUnit">次</span>
      </div>

      <div class="div_articlecount_bottom">今日访问量(pv)</div>
    </div>
  </div>

css代码:

<style>
.statistics_body {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
  padding: 10px;
}
.div_articlecount {
  width: 150px;
  height: 100px;
  padding: 10px;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 2px 4px 0 rgb(54 58 80 / 32%);
  border-radius: 8px;
}
.div_todayvisitcount {
  width: 170px;
  height: 100px;
  padding: 10px;
  margin-left: 20px;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 2px 4px 0 rgb(54 58 80 / 32%);
  border-radius: 8px;
}

.div_articlecount_top {
  font-size: 2rem;
  font-weight: 700;
  font-family: Arial;
}
.div_articlecount_top #articleCount {
  color: #24acf2;
}
.div_articlecount_top #articleUnit {
  font-size: 1.2rem;
  opacity: 0.7;
  font-weight: 700;
  margin-left: 0.3rem;
}

.div_articlecount_bottom {
  margin-top: 15px;
  font-size: 1rem;
  font-weight: 500;
  color: #787a7d;
}
</style>