2. CSS三角、CSS用户界面样式

2.1 CSS三角

网页中常见的一些三角形, 使用CSS直接画出来就可以, 不必做成图片或者字体图标。
CSS三角做法代码:

div {
     width: 0;
     height: 0;
     /* 兼顾兼容性
line-height: 0;
     font-size: 0; */
     border: 50px solid transparent;
     border-left-color: pink;
}

在这里插入图片描述

2.2 CSS三角强化

在这里插入图片描述

语法

width: 0;
height: 0;
/* 1.只保留右边的边框有颜色 */
border-color: transparent skyblue transparent transparent;
/* 2.样式都是solid */
border-style: solid;
/* 3.上边框宽度要大,右边框宽度稍小,其余边框为0 */
border-width: 100px 50px 0 0;

【示例代码】

<!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>
        .prc {
            width: 160px;
            height: 24px;
            border: 1px solid red;
            margin: 0 auto;
            line-height: 24px;
        }
        .miaosha {
            position: relative;
            float: left;
            width: 90px;
            height: 100%;
            background-color: red;
            text-align: center;
            color: #fff;
            font-weight: 700;
            margin-right: 8px;
        }
        .miaosha i {
            position: absolute;
            right: 0;
            top: 0;
            width: 0;
            height: 0;
            border-color: transparent #fff transparent transparent;
            border-style: solid;
            border-width: 24px 10px 0 0;
        }
        .de {
            font-size: 12px;
            color: gray;
            text-decoration: line-through;
        }
    </style>
</head>

<body>
    <div class="prc">
        <span class="miaosha">
            ¥1650
            <i></i>
        </span>
        <span class="de">¥5650</span>
    </div>
</body>

</html>

在这里插入图片描述

2.3 什么是界面样式

所谓的界面样式,就是更改一些用户操作样式,以便提高更好的用户体验。
●更改用户的鼠标样式
●表单轮廓
●防止表单域拖拽

2.4 鼠标样式cursor

li {cursor: pointer; }

设置或检索在对象上移动的鼠标指针采用何种系统预定义的光标形状。
在这里插入图片描述

2.5 轮廓线outline

给表单添加 outline:0; 或者 outline: none; 样式之后, 就可以去掉默认的蓝色边框。

input { outline: none; }

2.6 防止拖拽文本域resize

实际开发中,我们文本域右下角是不可以拖拽的。

textarea{ resize: none; }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值