zoukankan      html  css  js  c++  java
  • 通过伪类在标题两侧添加装饰线

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <style>
            .container{
                width: 1000px;
                margin: 10px auto;
                border: 1px solid red;
            }
            h3.title {
                color: #F2AE11;
                font-size: 1.3em;
                margin-bottom: 3em;
                text-align: center;
                font-weight: 500;
                line-height: 1.1;
            }
            h3.title span {
                display: block;     /*设置为块级元素会独占一行形成上下居中的效果*/
                font-size: 3em;
                color: #212121;
                position: relative;   /*定位横线(当横线的父元素)*/
            }
            h3.title span:before, h3.title span:after {
                content: '';                 /*CSS伪类用法*/
                position: absolute;         /*定位背景横线的位置*/
                top: 52%;
                background: #494949;       /*宽和高做出来的背景横线*/
                width: 9%;
                height: 2px;
            }
            h3.title span:before{
                left: 25%;        /*调整背景横线的左右距离*/
            }
            h3.title span:after {
                right: 25%;
            }
        </style>
    </head>
    <body>
    <div class="container">
        <h3 class="title">Welcome to <span>Snapshot</span></h3>
        <div class="row">
            
        </div>
    </div>
    </body>
    </html>
  • 相关阅读:
    Proxies
    内置的Symbol值
    css兼容问题大全
    Jquery ajax方法详解
    Ajax笔记
    Jquery笔记
    Css3笔记
    JavaScript学习笔记
    10 款优秀的文件管理插件推荐
    初始化和预装载servlet与JSP页面
  • 原文地址:https://www.cnblogs.com/supe/p/6667902.html
Copyright © 2011-2022 走看看