css特效——纯css绘制图标:带框的加号(添加按钮)、三横(三道杠)、带圈点(双层圆点)

带框的加号(添加按钮)

 

鼠标悬浮时会高亮

<template>
    <div style="padding: 20px">
        <div class="add"></div>
    </div>
</template>
<style scoped>
    .add {
        display: inline-block;
        width: 76px; height: 76px;
        color: #ccc;
        border: 2px dashed;
        transition: color .25s;
        position: relative;
        overflow: hidden;
    }
    .add:hover {
        color: #34538b;
    }
    .add::before, .add::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
    }
    .add::before {
        width: 20px;
        border-top: 4px solid;
        margin: -2px 0 0 -10px;
    }
    .add::after {
        height: 20px;
        border-left: 4px solid;
        margin: -10px 0 0 -2px;
    }
</style>

三横(三道杠)

<template>
    <div>
        <div class="icon-menu"></div>
    </div>
</template>
<style scoped>
    .icon-menu {
        width: 10px;
        height: 2px;
        border-top: 6px double;
        border-bottom: 2px solid;
    }
</style>

<template>
    <div>
        <i class="icon-menu"></i>
    </div>
</template>
<style scoped>
    .icon-menu {
        display: inline-block;
        width: 16px;
        height: 2px;
        padding: 4px 0;
        border-top: 2px solid;
        border-bottom: 2px solid;
        background-color: currentColor;
        background-clip: content-box;
    }
</style>

带圈点(双层圆点) 

<template>
    <div>
        <i class="icon-dot"></i>
    </div>
</template>
<style scoped>
    .icon-dot {
        display: inline-block;
        width: 16px;
        height: 16px;
        padding: 4px;
        border: 4px solid;
        border-radius: 50%;
        background-color: currentColor;
        background-clip: content-box;
    }
</style>

 

 

  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
您可以使用以下 HTML 和 CSS 代码来创建一个搜索图标的搜索框: HTML 代码: ```html <div class="search-box"> <form action="/search" method="get"> <input type="text" placeholder="Search..."> <button type="submit"><i class="fa fa-search"></i></button> </form> </div> ``` CSS 代码: ```css .search-box { display: flex; justify-content: center; align-items: center; margin: 20px; } input[type="text"] { padding: 10px; border: none; border-radius: 5px 0 0 5px; width: 200px; font-size: 16px; } button[type="submit"] { padding: 10px 15px; background-color: #4CAF50; border: none; border-radius: 0 5px 5px 0; color: white; font-size: 16px; cursor: pointer; } i.fa.fa-search { font-size: 16px; margin-right: 5px; } ``` 这里的 HTML 代码中包含一个名为 `search-box` 的 div 元素,用于设置搜索框的样式。在 div 元素内部,使用了 form 元素和 input 元素来创建搜索框,使用了 button 元素和 i 元素来创建搜索按钮和搜索图标。`placeholder` 属性提供了默认的提示文本,`name` 属性指定了提交的参数名称。 CSS 代码中使用了 `display: flex` 属性和 `justify-content: center` 和 `align-items: center` 属性来将搜索框水平居中。`border-radius` 属性用于设置输入框和按钮的圆角,`padding` 属性用于设置输入框和按钮的内边距,`width` 属性用于设置输入框的宽度。`background-color` 属性用于设置按钮的背景颜色,`color` 属性用于设置按钮的文字颜色,`cursor` 属性用于设置鼠标悬停时的光标类型。`fa` 和 `fa-search` 类名用于引用 Font Awesome 图标库中的搜索图标样式。 请注意,这里使用了 Font Awesome 图标库,您需要在页面中引入该库的 CSS 样式文件,例如: ```html <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> ```

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

朝阳39

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值