html - 加入分隔符和标题

标签 html css header

我有一些代码来显示分隔符和标题

我现在有

enter image description here

.content-wrap {
    width: 1024px;
    margin: 0 auto;
}

.content-wrap section section {
    background: none;
    margin: 0;
}
.content-wrap section {
position: relative;
padding: 125px 0 25px 0;
background: url(http://www.lebiscuit.com.mx/section-sep.png) repeat-x left 25px;
}



h1 {
    font-size: 40px;
    float: right;
    line-height: 50px;
    letter-spacing: -0.9px;
    color: #ffffff;
    padding:25px 0;
}


body {background-color:#b0c4de;}

这是html

<div class="content-wrap">
     <section id="services" >
             <h1>title</h1>
    </section>    
</div>

期望的输出是

enter image description here

如何保留分隔符并将分隔符添加到h1?

请找到jsfiddle here html

有点像

<h1 class="bck"></div>

.bck h1
{
float: right
margin: 10px
background-color:transparent;
}

最佳答案

由于您在该部分使用相对定位,因此最好在标题 (h1) 上使用绝对定位:

#services h1 {
    position: absolute;
    margin: 0;
    padding: 0;
    top: 0;
    right: 0;
    background-color: lightSteelBlue;
}

background-color 是为了让边框线不穿过标题。

http://jsfiddle.net/ExplosionPIlls/HR2Xa/2/

关于html - 加入分隔符和标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15081474/

相关文章:

html - CSS 边框动画适用于整个 Div 内容

javascript - 在 ionic 和 angularjs 移动应用程序的页面之间导航

html - 包装器未与页面顶部对齐

c++ - 为什么只在标题中声明函数

javascript - 向下滚动时固定导航

Java - 如何在接口(interface)实现中获取http header ?

javascript - 为什么我的 Angular 代码变成评论?

html - 使用内容框来偏移高度

javascript - 我能找到文件的大小并保存该文件吗

html - 将一堆 <li> 的第二行居中而不添加 div?