vue

作者: 裁尘的人儿 | 来源:发表于2020-07-20 17:45 被阅读0次

:hover选择器

选择鼠标浮动在上面的元素,并设置鼠标浮动在它上面时的样式

a:hover
{ 
background-color:yellow;
}
/*当鼠标浮动在a标签上时,a标签的背景颜色变成黄色*/

::before, ::after伪标签

这个两个伪元素在真正页面元素内部之前之后添加新内容(当然了,可以对伪元素应用定位可以置于任何位置)。

  <STYLE>
    a {
      position: relative;
      left:20px;
      margin-left:50px;
      display: inline-block;
      outline: none;
      text-decoration: none;
      color: #000;
      font-size: 32px;
      /*padding: 5px 10px;*/
    }

    a:hover::before, a:hover::after { position: absolute; }
    a:hover::before { content: "\5B"; left: -20px; }/*左中括号*/
    a:hover::after { content: "\5D"; right:  -20px; }/*右中括号*/

  </STYLE>
</head>
<body>
  <a>WAFTRUE</a>
  <a>SUMPTUOUS</a>
</body>

相关文章

网友评论

      本文标题:vue

      本文链接:https://www.haomeiwen.com/subject/wigoqktx.html