当前位置: 首页 > news >正文

css3实现0.5px边框

效果图

在这里插入图片描述

代码

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>css3实现0.5px边框</title><style>h5 {margin: 0;padding: 0;text-align: center;margin: 15px 0;}.group {display: flex;justify-content: center;align-items: center;}.item {width: 120px;height: 80px;background-color: rgba(238, 238, 238,.6);margin-right: 10px;box-sizing: border-box;}.item.top {border-top: 1px solid #e95325;}.item.right {border-right: 1px solid #e95325;}.item.bottom {border-bottom: 1px solid #e95325;}.item.left {border-left: 1px solid #e95325;}.item.all {border: 1px solid #e95325;}/* 0.5像素的 分割线 */.hairline,.hairline-top,.hairline-right,.hairline-bottom,.hairline-left {position: relative;}.hairline::after,.hairline-top::after,.hairline-right::after,.hairline-bottom::after,.hairline-left::after {position: absolute;top: -50%;right: -50%;bottom: -50%;left: -50%;content: " ";pointer-events: none;border: 0 solid #e95325;-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;-webkit-transform: scale(0.5);-moz-transform: scale(0.5);transform: scale(0.5);}.hairline::after {border-width: 1px;}.hairline-top::after {border-top-width: 1px;}.hairline-right::after {border-right-width: 1px;}.hairline-bottom::after {border-bottom-width: 1px;}.hairline-left::after {border-left-width: 1px;}</style>
</head><body><h5>上边框</h5><div class="group"><div class="item hairline-top"></div><div class="item top"></div></div><h5>右边框</h5><div class="group"><div class="item hairline-right"></div><div class="item right"></div></div><h5>下边框</h5><div class="group"><div class="item hairline-bottom"></div><div class="item bottom"></div></div><h5>左边框</h5><div class="group"><div class="item hairline-left"></div><div class="item left"></div></div><h5>四边框</h5><div class="group"><div class="item hairline"></div><div class="item all"></div></div>
</body></html>
http://www.lryc.cn/news/354715.html

相关文章:

  • U-Net网络
  • 不拍视频,不直播怎么在视频号卖货赚钱?开一个它就好了!
  • 【vue-5】双向数据绑定v-model及修饰符
  • [STM32-HAL库]AS608-指纹识别模块-STM32CUBEMX开发-HAL库开发系列-主控STM32F103C8T6
  • 【java程序设计期末复习】chapter4 类和对象
  • ios:Command PhaseScriptExecution failed with a nonzero exit code
  • 《拯救大学生课设不挂科第四期之蓝桥杯是什么?我是否要参加蓝桥杯?选择何种语言?如何科学备赛?方法思维教程》【官方笔记】
  • 数据挖掘案例-航空公司客户价值分析
  • 决策树与机器学习实战【代码为主】
  • 从感知机到神经网络
  • 【HMGD】STM32/GD32 I2C DMA 主从通信
  • leecode 226 翻转二叉树、101 对称二叉树、104 二叉树的最大深度
  • Redux基础
  • 国外目标公司的任何一个联系人也许都有意义
  • 因为本地证书太旧或不全导致的 HTTPS 访问失败问题20240520
  • Lua获取表的长度
  • python九九乘法表的打印思考及实现
  • 2.Spring中用到的设计模式
  • .NET调用阿里云人脸核身服务端 (ExecuteServerSideVerification)简易流程保姆级教学
  • [大师C语言(第十二篇)]C语言堆排序技术详解
  • Activity启动流程要点
  • lua 计算第几周
  • 负载均衡策略
  • 海外网红营销新趋势:“快闪式”营销如何迅速提升品牌曝光度
  • 速看!打造专属数字化能力模型的七大关键!
  • 青蛙跳台阶问题
  • linux日常运维2
  • flink cdc mysql整理与总结
  • 【三维重建】ePnP
  • C++进阶之路:何为运算符重载、赋值运算符重载与前后置++重载(类与对象_中篇)