Example code for CSS to achieve horizontal lines on both sides of the text

Example code for CSS to achieve horizontal lines on both sides of the text

This article introduces the sample code of CSS to achieve the effect of horizontal lines on both sides of the text center, and shares it with you. The specific notes are as follows:

Effect:

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .title{
            text-align: center;
            position: relative;
            height: 50px;
            line-height: 50px;
            width: 800px;
            margin: 200px auto;
        }
        .title:after,.title:before{
            content: "";
            position: absolute;
            top: 50%;
            background: #7a7a7a;
            height: 1px;
            width: 35%;
        }
        .title:after{
            left: 0;
        }
        .title:before{
            right: 0;
        }
    </style>
</head>
<body>
    <div class="title">CSS to achieve the effect of horizontal lines on both sides of the text center</div>
</body>
</html>

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

<<:  Steps to restore code from a Docker container image

>>:  H tags should be used reasonably in web page production

Recommend

Solutions to problems using addRoutes in Vue projects

Table of contents Preface 1. 404 Page 1. Causes 2...

Zabbix monitors the process of Linux system services

Zabbix automatically discovers rules to monitor s...

Linux kernel device driver kernel linked list usage notes

/******************** * Application of linked lis...

What does the n after int(n) in MySQL mean?

You may already know that the length 1 of int(1) ...

Complete steps to build NFS file sharing storage service in CentOS 7

Preface NFS (Network File System) means network f...

Install mysql offline using rpm under centos 6.4

Use the rpm installation package to install mysql...

TypeScript learning notes: type narrowing

Table of contents Preface Type Inference Truth va...

A detailed introduction to the netstat command in Linux

Table of contents 1. Introduction 2. Output Infor...

How to Clear Disk Space on CentOS 6 or CentOS 7

Following are the quick commands to clear disk sp...

Explanation of the configuration and use of MySQL storage engine InnoDB

MyISAM and InnoDB are the most common storage eng...

The pitfalls and solutions caused by the default value of sql_mode in MySQL 5.7

During normal project development, if the MySQL v...

Tips on MySQL query cache

Table of contents Preface Introduction to QueryCa...