How to make hover state on row table with CSS grid layout

后端 未结 5 1053
伪装坚强ぢ
伪装坚强ぢ 2020-12-14 16:52

This a table that created with CSS Grid Layout, but I have a problem with it, I can\'t make hover state on each row.

I only want use CSS for this.

Can anyone

5条回答
  •  死守一世寂寞
    2020-12-14 17:31

    I have solution for your problem. The example below:

    .grid .row {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      border-bottom: 1px solid gray;
    }
    .grid .row div {
      padding: 10px;
      display: flex;
      align-items: center;
    }
    .grid .row:last-child {
      border: none;
    }
    .grid .row:hover {
      background-color: #cccccc;
      transition: .2s all;
    }
    Header
    Header
    Header
    Header
    Content
    Content
    Content
    Content
    Content
    Content
    Content
    Content
    Content
    Content
    Content
    Content

提交回复
热议问题