Create diagonal border of a cell

后端 未结 4 1201
渐次进展
渐次进展 2021-02-06 01:26

I wonder if it is even possible creating a table with diagonal border line using css or jquery just like below:

\"en

4条回答
  •  滥情空心
    2021-02-06 02:21

    Officially a table cannot have diagonal borders but with little CSS tricks you can make it appear so, here's the code..

    .borderdraw {
    position:fixed;
        border-style:solid;
        height:0;
        line-height:0;
        width:0;
        z-index:-1;
    
    }
    
    table td
        { 
            width:60px; 
                max-height:55px; 
            border:1px solid #000;
        }
    
    .tag1{ z-index:9999;position:absolute;top:40px; }
    
    .tag2 { z-index:9999;position:absolute;left:40px; }
    
    .diag { position: relative; width: 50px; height: 50px; }
    .outerdivslant { position: absolute; top: 0px; left: 0px; border-color: transparent transparent transparent rgb(64, 0, 0); border-width: 50px 0px 0px 60px;}
    .innerdivslant {position: absolute; top: 1px; left: 0px; border-color: transparent transparent transparent #fff; border-width: 49px 0px 0px 59px;}                  
    
    

      
    Tag1
    Tag2

    And here's the output.

    enter image description here

    Hope it helps.

提交回复
热议问题