zoukankan      html  css  js  c++  java
  • CSS伪类伪元素

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>伪类和伪元素选择器</title>
        <style type="text/css">
            .link{
            font-size: 30px;
            text-decoration: none;
            color:pink;
            }
            .link:hover{
                color: yellow;
                font-weight: bold;
            }
            /*伪类,相当于元素的默认属性,一直都有,但是一般不进行改动
                通常情况先弥补top塌陷bug和消除浮动bug的时候才会用到before和after
                hover是制作鼠标悬停效果
            */
            /*伪类常用的就只有hover 类名后用冒号:hover表示*/
            
            .box1, .box2{
                font-size:55px;
    
            }
            
            .box1:before{
                /*before 伪元素能够在标签前面添加内容, 其内容不可选中, 称之为 伪元素*/
                content: ".123";
                /*冒号分号一定要成对出现*/
                color:green;
    
            }        
            .box2:after{
                content: ".//";
                color:green;
    
            }
    
    
        </style>
    </head>
    <body>
        <a href="http://www.baidu.com" class="link">百度</a>
        <br /><br /><br /><br />
        <div class="box1">这是第一个div元素块</div>
        <div class="box2">这是第二个div元素块</div>
    </body> 
    </html>
  • 相关阅读:
    Git CMD
    Guava Cache相关
    137.Single Number II---位运算---《剑指offer》40
    SpringMVC数据绑定
    StringUtils工具类的使用
    sql注入
    mapper配置文件中的动态SQL
    json相关注解和序列化与反序列化
    用户模块
    横向越权与纵向越权
  • 原文地址:https://www.cnblogs.com/jrri/p/11346380.html
Copyright © 2011-2022 走看看