Is there a clean way to get borders on a in pure CSS?

前端 未结 1 1965
再見小時候
再見小時候 2021-01-02 17:10

I\'d like to set a background and a rounded border on a , such as

tbody { border-radius: 15px; border: 1px solid black; background         


        
1条回答
  •  说谎
    说谎 (楼主)
    2021-01-02 17:27

    Assuming you have collapsed the borders in the table, simply set display:block on the tbody and apply the border-radius.

    Codepen example

    CSS

    table {
        width: 100%;
        border-collapse: collapse;
        display: block;
        width: 600px;
    }
    
    tbody {
        background: #ccf;
        border: 1px solid black;
        border-radius: 15px;
        display: block;
    }
    
    th, td {
        width: 200px;
    }
    
    td, th {
        padding: 5px;
        text-align: center;
    }
    

    0 讨论(0)
提交回复
热议问题