Border Radius of Table is not working

后端 未结 7 847
谎友^
谎友^ 2020-12-13 02:12

I want to add a border radius around the entire table. But the following code is not working in both the latest versions of Firefox and Google Chrome.

HTML

7条回答
  •  失恋的感觉
    2020-12-13 02:40

    border-collapse: separate !important; worked.

    Thanks.

    HTML

    CSS

    table {
        border-collapse: separate !important;
        border-spacing: 0;
        width: 600px;
        margin: 30px;
    }
    .bordered {
        border: solid #ccc 1px;
        -moz-border-radius: 6px;
        -webkit-border-radius: 6px;
        border-radius: 6px;
        -webkit-box-shadow: 0 1px 1px #ccc;
        -moz-box-shadow: 0 1px 1px #ccc;
        box-shadow: 0 1px 1px #ccc;
    }
    .bordered tr:hover {
        background: #ECECEC;    
        -webkit-transition: all 0.1s ease-in-out;
        -moz-transition: all 0.1s ease-in-out;
        transition: all 0.1s ease-in-out;
    }
    .bordered td, .bordered th {
        border-left: 1px solid #ccc;
        border-top: 1px solid #ccc;
        padding: 10px;
        text-align: left;
    }
    .bordered th {
        background-color: #ECECEC;
        background-image: -webkit-gradient(linear, left top, left bottom, from(#F8F8F8), to(#ECECEC));
        background-image: -webkit-linear-gradient(top, #F8F8F8, #ECECEC);
        background-image: -moz-linear-gradient(top, #F8F8F8, #ECECEC);    
        background-image: linear-gradient(top, #F8F8F8, #ECECEC);
        -webkit-box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
        -moz-box-shadow:0 1px 0 rgba(255,255,255,.8) inset;
        box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
        border-top: none;
        text-shadow: 0 1px 0 rgba(255,255,255,.5);
    }
    .bordered td:first-child, .bordered th:first-child {
        border-left: none;
    }
    .bordered th:first-child {
        -moz-border-radius: 6px 0 0 0;
        -webkit-border-radius: 6px 0 0 0;
        border-radius: 6px 0 0 0;
    }
    .bordered th:last-child {
        -moz-border-radius: 0 6px 0 0;
        -webkit-border-radius: 0 6px 0 0;
        border-radius: 0 6px 0 0;
    }
    .bordered th:only-child{
        -moz-border-radius: 6px 6px 0 0;
        -webkit-border-radius: 6px 6px 0 0;
        border-radius: 6px 6px 0 0;
    }
    .bordered tr:last-child td:first-child {
        -moz-border-radius: 0 0 0 6px;
        -webkit-border-radius: 0 0 0 6px;
        border-radius: 0 0 0 6px;
    }
    .bordered tr:last-child td:last-child {
        -moz-border-radius: 0 0 6px 0;
        -webkit-border-radius: 0 0 6px 0;
        border-radius: 0 0 6px 0;
    } 
    

    jsFiddle

提交回复
热议问题