web基础

一、字体图标的用法(三种)

1.本地使用字体图标:

<link rel="stylesheet" href="./fonts/iconfont.css">

例子:
  <i class="iconfont icon-auto class"></i>
    <i class="iconfont class">&#xe742;</i>
    <a href="#">
        <i class="iconfont">&#xe742;</i>
    </a>
   

2.线上字体图标:

 <link rel="stylesheet" href="http://at.alicdn.com/t/font_3391737_27qg05rp516.css">
例子:
 <i class="iconfont icon-add-cart"></i>

3.子字体图标ucicode

  <i class="iconfont fonts"> &#xe7aa;</i>

拓展-字体图标的伪类使用:

  i::after{
            content: '\e7b2';
        }

<body>
    <i class="iconfont"></i>
</body>

二、盒子居中(三种方法)

1.marign居中

<style>
        .box{
            width: 600px;
            height: 600px;
            background-color: aqua;
            border: 1px solid red;
            margin: 0 auto  ;
        }
        .son{
            width: 200px;
            height: 200px;
            background-color: #bfa;
            margin-left:200px ;
            margin-top: 200px;
        }
    </style>
</head>
<body>
    
    <div class="box">
        <div class="son"></div>
    </div>
</body>

2.定位居中

<style>
        .box{
            width: 600px;
            height: 600px;
            background-color: aqua;
            margin: 0 auto  ;
            position: relative;
        }
        .son{
            width: 200px;
            height: 200px;
            background-color: #bfa;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
        }
    </style>
</head>
<body>
    
    <div class="box">
        <div class="son"></div>
    </div>

3.定位和marign

    <style>
        .box{
            width: 600px;
            height: 600px;
            background-color: aqua;
            margin: 0 auto  ;
            position: relative;
        }
        .son{
            width: 200px;
            height: 200px;
            background-color: #bfa;
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            margin: auto;
        }
    </style>
</head>
<body>
    
    <div class="box">
        <div class="son"></div>
    </div>
</body>

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值