简体   繁体   English

使文字重叠到1px水平线

[英]Make Text Overlap to 1px horizontal line

I am trying to put my text on the horizontal line. 我试图将我的文字放在水平线上。 I want if the text length increases the line should get adjusted according to the text length. 我想如果文本长度增加,该行应根据文本长度进行调整。 which is working fine on IE7,8, Mozilla. 在IE7,8,Mozilla上运行正常。 I want to make it work for Google Chrome. 我想使其适用于Google Chrome。

It's working fine except Google Chrome. 除Google Chrome浏览器外,一切正常。 Here is my code: 这是我的代码:

/*CSS*/
.pageHD{ font-size:30px; color:#369; font-weight:bold; padding:20px 0} .pageHD p{display:block; margin-right:10px}
.title-line{ height:1px; border:0 none; background:#e5e5e5; position: relative; right:0; top:0px} 
<!--HTML-->  
<div class="pageHD"><p class="left">Zones Showcases</p> <hr class="title-line" /></div>

Can anybody help me for this. 有人可以帮我吗? Thanks.! 谢谢。!

Here's what I understand on your question: 这是我对您的问题的理解:

You want to make a text overlap a hr element. 您要使文本与hr元素重叠。

If I'm not mistaken on understanding your question, then this would be my answer. 如果我没错理解您的问题,那么这就是我的答案。

Just make a content after the hr so it would overlap the hr. 只需在小时后制作一个内容,使其与小时重叠即可。

Your new HTML would be: 您的新HTML将是:

<div class="pageHD"><hr class="title-line" /></div>

And your new CSS would be: 您的新CSS将是:

.pageHD {
    font-size:30px;
    color:#369;
    font-weight:bold;
    padding:20px 0
}
.pageHD p {
    display:block;
    margin-right:10px
}
.title-line{
    height:1px;
    border:0 none;
    background:#e5e5e5;
    position: relative;
    right:0;
    top:0px;
    z-index: 0;
}
.title-line:after {
    position: absolute;
    content: 'Zone Showcases';
    bottom: -15px;
    z-index: 1;
}

Here's a jsFiddle Example: jsFiddle Example 这是一个jsFiddle示例: jsFiddle示例

this will solve your problem 这将解决您的问题

border-bottom:1px solid #e5e5e5;

Check this fiddle 检查这个小提琴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM