如何在Div边框上设置文字?

时间:2015-02-20 05:06:07

标签: html css

我想div css为div创建一个div,在右上边框显示div的名称。喜欢:----------- DEMO ------------------------------------ -

1 个答案:

答案 0 :(得分:0)

我认为你需要跟随:

<强> HTML:

<div class="test">
   <span>Your text </span>
</div>

<强> CSS:

.test {
border: 1px solid #000000;
line-height: 0;
text-align: left; 
margin-top:40px;
height:100px;
width:400px;
}

.test span { 
background-color: #ffffff;
padding: 0 10px;
margin: 0 20px;
}

检查Fiddle