【CSS3实战】改善页内导航效果

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=>, initial-scale=1.0">
  <title>Document</title>
  <style>
    body,
    ul,
    li {
      margin: 0;
      padding: 0;
      list-style-type: none;
    }

    h1 {
      display: none;
    }

    ul {
      width: 1259px;
      height: 601px;
      position: relative;
    }

    ul a {
      text-decoration: none;
      color: #000;
      font-weight: bold;
      font-family: "黑体";
      font-size: 20px;
    }

    ul li {
      position: absolute;
    }

    li:nth-of-type(1) {
      left: 280px;
      top: 200px;
    }

    li:nth-of-type(2) {
      left: 670px;
      top: 200px;
    }

    li:nth-of-type(3) {
      left: 980px;
      top: 200px;
    }

    div {
      width: 1259px;
      position: relative;
      text-align: center;
      padding-left: 117px;
    }

    div h2 {
      position: absolute;
      width: 919px;
      margin: auto;
      text-align: left;
      padding: 70px 0 0 100px;
      color: #000;
      font-weight: bold;
      font-family: "黑体";
      font-size: 20px;
    }

    h2:nth-of-type(1) {
      left: 391px;
      top: -50px;
    }

    h2:nth-of-type(2) {
      left: 390px;
      top: 341px;
    }

    h2:nth-of-type(3) {
      left: 393px;
      top: 731px;
    }

    h2:target {
      color: red;
    }
  </style>
</head>

<body>
  <h1>改善页内导航视觉效果</h1>
  <ul>
    <li><a href="#h1">应用程序安装</li>
    <li><a href="#h2">音乐下载与管理</li>
    <li><a href="#h3">手机视频下载和转码</li>
  </ul>
  <div>
    <h2 id="h1">应用程序安装</h2>
    <h2 id="h2">音乐下载与管理</h2>
    <h2 id="h3">手机视频下载和转码</h2>
  </div>
</body>

</html>

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值