zl程序教程

您现在的位置是:首页 >  前端

当前栏目

css:图文效果(上面图片下面文字)

CSS 图片 效果 文字 图文 下面 上面
2023-09-27 14:27:10 时间

效果

在这里插入图片描述

代码

<div class="content-account">
  <div>
    <i></i>
    <p>学习计划</p>
  </div>
  <div>
    <i></i>
    <p>我的练习</p>
  </div>
</div>
.content-account {
  display: flex;
  & > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 1.2rem;
    height: 0.95rem;
    margin-right: 0.8rem;
    position: relative;
    p {
      font-size: 0.3rem;
      color: #666666;
      position: absolute;
      bottom: 0;
    }
  }
  // 学习计划
  & > div:nth-of-type(1) {
    i {
      width: 0.48rem;
      height: 0.48rem;
      background: url("../assets/logo-plan.png") no-repeat;
      background-size: 100% auto;
    }
  }
  // 我的练习
  & > div:nth-of-type(2) {
    i {
      width: 0.38rem;
      height: 0.38rem;
      background: url("../assets/logo-practice.png") no-repeat;
      background-size: 100% auto;
    }
  }
}