Table padding not working

前端 未结 4 899
长发绾君心
长发绾君心 2021-02-18 15:50

I have a table that sits within a parent div full of body text and other content. I have the following CSS which does not seem to work:

table {width:100%; paddin         


        
4条回答
  •  孤城傲影
    2021-02-18 15:55

    The prior answer shows that css can set border-[direction] for ea direction separately. But a much simpler css-only solution that replicates the old-style table cellpadding="7" border="1" can be the following. In CSS:

    table { 
      border-collapse:collapse;
      width: 100%;
    }
    td {
      padding: 7px;
      border:1px solid;
    } 
    

    Shown in this fiddle: http://jsfiddle.net/b5NW5/77

提交回复
热议问题