两边横线 中间汉字 js效果实现

话不多说,直接上css 样式代码:

CSS text-decoration 属性 文本修饰:

可以控制一条线从不同的位置以不同的状态、姿势来通过一段文字。

<html>
<head>
<style type="text/css">
h1 {text-decoration: overline}
h2 {text-decoration: line-through}
h3 {text-decoration: underline}
h4 {text-decoration:blink}
a {text-decoration: none}
</style>
</head>

<body>
<h1>这是标题 1</h1>
<h2>这是标题 2</h2>
<h3>这是标题 3</h3>
<h4>这是标题 4</h4>
<p><a href="http://www.w3school.com.cn/index.html">这是一个链接</a></p>
</body>

</html>

效果图:

三种属性可以简写:text-decoration: underline red solid。 

后来并没有用这个属性,因为不管怎么设置,线都是连续的,没有断开的感觉。

CSS vertical-align 属性 设置元素的垂直对齐方式。文档中介绍的不是很清楚,但是这边也实现了,过程也很简单,如果想详细了解这个属性的用法的话,可以参考下面这篇文章。

http://www.cnblogs.com/starof/p/4512284.html

猜你喜欢

转载自blog.csdn.net/weixin_40805079/article/details/86250877