CSS: borders between table columns only

前端 未结 10 1592
有刺的猬
有刺的猬 2020-12-07 20:11

Is there a way, using CSS, to show borders in a table between columns only (not on the outer edges)?

10条回答
  •  一向
    一向 (楼主)
    2020-12-07 20:19

    I used this in a style sheet for three columns separated by vertical borders and it worked fine:

    #column-left {
         border-left: 1px solid #ffffdffffd;
    }
    #column-center {
         /*no border needed/*
    }
    #column-right {
         border-right: 1px solid #ffffdffffd;
    }
    

    The column on the left gets a border on the right, the column on the right gets a border on the left and the the middle column is already taken care of by the left and right.

    If your columns are inside a div/wrapper/table/etc... don't forget to add extra space to accomodate the width of the borders.

提交回复
热议问题