Change body background color on link hover

前端 未结 2 1131
情书的邮戳
情书的邮戳 2021-01-14 07:56

How can I change the the page background when the mouse is hovered on a a? I\'m looking for a css only solution.

I know that you can reach the child ele

2条回答
  •  情歌与酒
    2021-01-14 08:38

    Take a look at this DEMO

    Here is html part of it

    link 1
    

    And here is the css

    body {
            background: lightblue;
        }
        a:hover:before {
            content: '';
            position: fixed;
            display: block;
            top: 0; bottom: 0; left: 0; right: 0;
            z-index: -1;
            background-color: grey;
        }
    

提交回复
热议问题