用样式控制文字居中显示
先看要实现的效果
代码如下
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> <title>Title</title> <style> .hayu_title{height: 66px;width: 100%;border: 1px solid transparent;border-bottom: 1px solid #a0a0a0;margin: 56px auto;} .hayu_title p{height: 40px;font-weight: bold;margin-top: 33px; text-align: center;} .hayu_title p span{padding: 0 30px; background: #fff;font-size: 40px;color: #000;} </style> </head> <body> <div class="hayu_title"> <p><span>活动介绍</span></p> </div> </body> </html>
原文:https://www.cnblogs.com/shanshanjiadexiaohai/p/11028363.html