课程学习及笔记

练习1

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    /* 因为有通栏:占满一行的边框,所以需要有一个通栏:占满一行的盒子 */
    .nav {
      height: 40px;
      border-bottom: 1px solid #ccc;
    }

    /* 因为ul中所有的内容都是在网页的宽度固定并且水平居中的盒子内部,所以设置ul为宽度固定并且水平居中的效果(后面项目中所用到的版心) */
    ul {
      list-style: none;
      width: 1200px;
      margin: 0 auto;
    }

    ul li {
      float: left;
      width: 20%;
      height: 40px;
      border-right: 1px solid #ccc;
      /* 自动内减 */
      box-sizing: border-box;
      text-align: center;
      line-height: 40px;
    }

    ul .last {
     border-right: none;
    }

    ul li a {
      /* a标签默认是行内元素,宽高由内容撑开,并且无法设置宽高,此时默认情况用户只能点击文字区域才能调整 */
      /* 如果把a标签转换成块级元素,此时可以设置宽高,会让a标签范围更大,用户可以点击调整的区域也越大 */
      display: block;
      /* 宽度不设置块元素会默认占满一行 */
      height: 40px;
      text-decoration: none;
      color: #000;
    }

    ul li .app {
      position: relative;
    }

    ul li .app .code {
      /* 子绝父相 */
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
      /* 为了img标签不遮住a标签的主体内容 */
      top: 40px;
      border: 1px solid #ccc;
     
    }
    .nav{
      background-color: red;
      display:inline-block;
    }
    a img{
      display: none;
    }
    a:hover img{
      display:block;
    }

  </style>
</head>
<body>
  <!-- 导航 -->
  <div class="nav">
    <ul>
      <li><a href="#">我要投资</a></li>
      <li><a href="#">平台介绍</a></li>
      <li><a href="#">新手专区</a></li>
      <!-- 因为用户鼠标放在二维码图片上也能跳转,所以证明img也是在a的范围内,因此把img写在a标签的内部 -->
      <li><a href="#" class="app">手机微金所<img src="./练习/code.jpg" alt="" class="code"></a></li>
      <li class="last"><a href="#">个人中心</a></li>
    </ul>
  </div>
</body>
</html>

练习2

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0%;
            margin: 0%;
        }
        .father{
            width: 300px;
            height: 400px;
            background-color: aliceblue;
            border: 20px;
        }
        .box1{
            width: 300px;
            height: 400px;
           position: relative;
            left: 0%;
            top: 0%;
        }
        .box2{
            border: 1px;
            position: absolute;
            width: 300px;
            height: 400px;
            left: 30%;
            top: 25%;
        }
        .box1:hover{
            opacity: 0.35;
        }
    </style>
</head>
<body>
    <div class="father">
    <div class="box1">
        <img src="./sed.jpg">
     </div>
     <div class="box2"><img src="./arr.png" alt="">
     </div>
    </div>
</body>
</html>

笔记

background-position: left top;   精灵图
            background-size: auto;  自适应
            background-attachment: fixed;  固定图片
            border-radius: 20px;   添加圆角边框
            font-size: 12px; 字体大小
            font-family: "微软雅黑";
            font-style:italic;   斜体
            font-weight: 800;  加粗
            opacity  改变透明度
            display  显示
            resize:none; 使文本框固定不能随意拖拽
            vertical-align  设置文本框旁边文字的位置
            word-spacing: 30px;  改变单词的间隔
            margin: 0 auto;  标签水平居中
            color: rgb 可调色
            direction:  文本方向
            cursor:  鼠标样式
            list-style-type: none;  设置列表样式
            list-style-image: url();  放入图片
            border-collapse: collapse;  合并相邻边框
            position:fixed;   固定定位
            position:sticky;  粘性定位
            position: relative;   相对定位
            position:absolute;   绝对定位
            z-index: 1;   优先显示

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值