lundi 29 mai 2017

How can I change colors of table rows with css?

i have a Problem.

Here is my CSS:

.tabelle {
    width: 90%; border-collapse: collapse;
        margin-left:auto;
        margin-right:auto;
}


.separate {
    border-radius: 10px;
    border-spacing: 0;
    border-collapse: separate;
}
.separate td, table.separate th {
    border-bottom: 1px solid Gray;
    border-right: 1px solid Gray;
}
.separate tr:last-child td:first-child {
    border-bottom-left-radius: 10px;
}
.separate tr:last-child td:last-child {
    border-bottom-right-radius: 10px;
}
.separate tr th:first-child, table.separate tr td:first-child {
    border-left: 1px solid Gray;
}
.separate tr:first-child th, table.separate tr:first-child td {
    border-top: 1px solid Gray;
}
.separate tr:first-child th:first-child, table.separate tr:first-child td:first-child {
    border-top-left-radius: 10px
}
.separate tr:first-child th:last-child, table.separate tr:first-child td:last-child {
    border-top-right-radius: 10px;
}

.zelle{
    padding: 10px;
    background-color: White;
    font-family: Verdana;
    font-size: 12px;
    text-align: center;
    color: Black;
}
th {
    background-color: #A58AB4;
    padding: 8px;
    color: White;
    font-size: 12px;
    font-family: Verdana;
}

I tried it with:

.tabelle tr:nth-child(even){
        background: #dae5f4;
    }

.tabelle tr:nth-child(odd){ 
        background: #b8d1f3;
    }

But it doesn't work. I have googled to solve my problem, but i cannot find a working solution.

I want to have one color for one row and another color for the second row. But not more than 2 colors.

Can anybody help me?




Aucun commentaire:

Enregistrer un commentaire