zoukankan      html  css  js  c++  java
  • css-方形边框四角

    项目中遇到下图这种样式,刚开始想切图解决 后来想到更好的解决办法,代码如下:

    HTML:

    <div class="BoxWrap">
         <div class="horn">
            <div class="lt"></div>
            <div class="rt"></div>
            <div class="rb"></div>
            <div class="lb"></div>
         </div>
      </div>
    

    css:

    .BoxWrap{
          	 100px;
          	height: 100px;
          	position: relative;
          }
          .horn{
          	position: absolute;
          	 100%;
          	height: 100%;
          	border:1px solid #00d3e7;
          }
          .horn>div{
             10px;
            height: 10px;
            position:absolute;
          }
          .horn .lt{
          	border-top: 3px solid #00d3e7;
          	border-left: 3px solid #00d3e7;
          	left: -2px;
          	top: -2px;
          }
          .horn .rt{
          	border-top: 3px solid #00d3e7;
          	border-right: 3px solid #00d3e7;
          	right: -2px;
          	top: -2px;
          }
          .horn .rb{
          	border-bottom:3px solid #00d3e7;
          	border-right: 3px solid #00d3e7;
          	right: -2px;
          	bottom: -2px;
          }
          .horn .lb{
          	border-bottom:3px solid #00d3e7;
          	border-left: 3px solid #00d3e7;
            left: -2px;
            bottom: -2px;
          }
    

     最外层容器使用相对定位,子元素使用绝对定位,再调整四个角的小div的位置,就达到上面的图例的效果了。

  • 相关阅读:
    MSP430:输入捕获
    MSP430:串口输出
    测试输出时钟频率
    C# MySql Select
    C# MySql 连接
    MSP430:PWM产生
    MSP430:定时器学习TimerA
    MSP430:中断简介
    MSP430 PIN 操作寄存器
    剑指offer---包含min函数的栈
  • 原文地址:https://www.cnblogs.com/harlem/p/7053135.html
Copyright © 2011-2022 走看看