用CSS在标题后画线 [英] Draw line after a title with CSS

查看:56
本文介绍了用CSS在标题后画线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我该如何在标题文本之后画一条线:

How can I draw a line like after title text like this :

标题________

"TITLE ________"

CSS 中?

_应完成div的其余部分并填充剩余空间。

In CSS?
The "_" should complete the rest of the div and fill the remaining space.

推荐答案

基于此答案

h1{
  overflow:hidden;
}
h1:after{
  content:'';
  display:inline-block;
  width:100%; height:100%;
  margin-right:-100%;
  border-bottom:1px solid #000;
}

<h1>Title</h1>
<h1>Longer Title</h1>

这篇关于用CSS在标题后画线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆