styling an image title attribute using css?

前端 未结 7 1364
猫巷女王i
猫巷女王i 2020-12-14 13:07

I want to style the text we see when we hover over the image. I tried the following but it won’t work:


         


        
7条回答
  •  猫巷女王i
    2020-12-14 13:25

    Nothing is impossible. edited the solution by Andres Ilich to the question: How to change the style of Title attribute inside the anchor tag?

    a {
      color: #900;
      text-decoration: none;
    }
    
    a:hover {
      color: red;
      position: relative;
    }
    
    a[data]:hover:after {
      content: attr(data);
      padding: 4px 8px;
      color: rgba(0,0,0,0.5);
      position: absolute;
      left: 0;
      top: 100%;
      white-space: nowrap;
      z-index: 2;
      border-radius: 5px ;
      background: rgba(0,0,0,0.5);
    }
    Link

提交回复
热议问题