CSS常见的基本样式问题汇总

1. 去除a标签下划线

a {
text-decoration: none;
}

2. 去除li标签前面小黑点

li {
list-style: none;
}

3. 让li标签横向排列

li {
float: left;
}

4. 垂直水平居中的方式

width: 100px;
height: 100px;
position: absolute;
left: 50%;
top: 50%;
margin: -50px 0 0 -50px;

实例:

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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .a1 {
            background-color: red;
            border: 1px solid;
            width: 150px;
            height: 150px;
            position: absolute;
            left: 50%;
            top: 50%;
            margin: -75px 0 0 -75px;
        }

        .a2 {
            background-color: green;
            border: 1px solid;
            width: 100px;
            height: 100px;
            position: absolute;
            left: 50%;
            top: 50%;
            margin: -50px 0 0 -50px;
        }

        .a3 {
            background-color: blue ;
            border: 1px solid;
            width: 50px;
            height: 50px;
            position: absolute;
            left: 50%;
            top: 50%;
            margin: -25px 0 0 -25px;
        }
    </style>
</head>

<body>
    <div class="a1">盒子1</div>
    <div class="a2">盒子2</div>
    <div class="a3">盒子3</div>
</body>

</html>

在这里插入图片描述

5.设置圆框边角

设置成圆形:
border-radius:50%;在这里插入图片描述
设置某一个角:(左上角)

border-top-left-radius:50%;

在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值