A
A
Amir2018-02-21 10:53:26
css
Amir, 2018-02-21 10:53:26

How to make tr's box-shadow overlap the next tr in the table?

Hello.
In general, there is a table:

<table>
            <thead>
                <tr>
                    <th>One</th>
                    <th>Two</th>
                    <th>Three</th>
                    <th>Four</th>
                    <th>Five</th>
                    <th>Six</th>
                    <th>Seven</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>1</td>
                    <td>2</td>
                    <td>3</td>
                    <td>4</td>
                    <td>5</td>
                    <td>6</td>
                    <td>7</td>
                </tr>
                <tr>
                    <td>1</td>
                    <td>2</td>
                    <td>3</td>
                    <td>4</td>
                    <td>5</td>
                    <td>6</td>
                    <td>7</td>
                </tr>
                <tr>
                    <td>1</td>
                    <td>2</td>
                    <td>3</td>
                    <td>4</td>
                    <td>5</td>
                    <td>6</td>
                    <td>7</td>
                </tr>
                <tr>
                    <td>1</td>
                    <td>2</td>
                    <td>3</td>
                    <td>4</td>
                    <td>5</td>
                    <td>6</td>
                    <td>7</td>
                </tr>
        </tbody>
    </table>

body {
    margin: 0;
    background: #eee;
}

table {
    width: calc(100% - 40px);
    margin: 40px 20px;
    border-collapse: separate;
    border-spacing: 0 10px;
}

table tbody tr {
    cursor: pointer;
    border-radius: 10px;
}

table tbody tr:hover {
    box-shadow: 0 12px 10px 0 rgba(0,0,0,0.15);
}

table tbody tr td {
    background-color: #fff;
    padding: 10px 20px;
}

table tbody tr > td:first-child {
    border-radius: 10px 0 0 10px;
}

table tbody tr > td:last-child {
    border-radius: 0 10px 10px 0;
}

When you hover over a line, a shadow appears that hides behind the next line. And I need it to be on top of the next line. Please help me solve the problem.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kreotech, 2018-02-21
@Guedda

You need to add z-index:
https://jsfiddle.net/kreoTech/74qcu8gt/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question