如何使标题栏折叠在网页css上

Joh*_*oyd 7 html css effect

有人可以告诉我CSS代码或指向我如何实现这种效果的教程一直看.这是我正在谈论的图像:

在此输入图像描述

注意:我知道如何绝对定位我只需知道它们如何消除效果.

Gab*_*oli 6

如果功能区是问题,那么在空(0大小)元素(可以使用:after伪元素添加)上使用边框.

HTML

<div id="content">
    <div id="ribbon"></div>
</div>
Run Code Online (Sandbox Code Playgroud)

CSS

#content{
    background-color:#77c;
    width:300px;
    height:200px;
    position:relative;
}
#ribbon{
    position:absolute;
    width:80px;
    height:30px;
    right:-20px;
    top:50px;
    background-color:#999;
}
#ribbon:after{
    content:'';
    width:0;
    height:0;

    border-color: transparent transparent #666 #666;
    border-style:solid;
    border-width:5px 10px;

    position:absolute;
    right:0;
    top:-10px;
}
Run Code Online (Sandbox Code Playgroud)

演示 http://jsfiddle.net/gaby/zJPhy/