前端制作

使用float: left将格子左浮动。

设置格子背景颜色,字体颜色,鼠标放上去后的字体颜色和背景颜色

<style>
    .title {
      width: 100%;
      overflow: hidden;
    }
    .title-topic a {     /*以下元素应用于topic*/
      float: left;     /*左浮动,让12个格子在一行*/
      width: 8.33%;    /* 每个格子宽度为总宽度的 1/12 */
      box-sizing: border-box;
      text-align: center;    /*居中对齐*/
      background-color:blue;    /*背景颜色*/
      padding: 20px;
      display: block;       /*将元素显示为块级元素*/
      color:blueviolet;    /*文本颜色*/
    }
    .title-figure a {    /*以下元素应用于figure*/
      float: left;
      width: 8.33%; 
      box-sizing: border-box;
      text-align: center;
      background-color: #fe722171;
      padding: 20px;
      display: block;
      color: rgb(15, 12, 13);
    }
    .title-figure a:hover{     /*悬停,鼠标移到格子时改变字体和背景颜色*/
        color: red;
        background-color:bisque;
    }
    .title-topic a:hover{
        color: red;
        background-color: aqua;
    }
  </style>
   <div class="title"> /*#--#表示该链接的目标URL为当前页面本身,不会跳转到其他页面
    <div class="title-topic"><a href="#">人物简介</a></div>
    <div class="title-figure"><a href="#">梅西</a></div>
    <div class="title-figure"><a href="#">C罗</a></div>
    <div class="title-figure"><a href="#">姆巴佩</a></div>
    <div class="title-figure"><a href="#">武磊</a></div>
    <div class="title-figure"><a href="#">内马尔</a></div>
    <div class="title-figure"><a href="#">赵忠祥</a></div>
    <div class="title-figure"><a href="#">李光洙</a></div>
    <div class="title-figure"><a href="#">迭戈·阿方索</a></div>
    <div class="title-figure"><a href="#">阿图罗·比达尔</a></div>
    <div class="title-figure"><a href="#">金秀炫</a></div>
    <div class="title-figure"><a href="#">巴黎斯</a></div>
  </div>

效果图

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值