I wonder if it's possible to make a table containing a "text" in the middle of the lines!
Here's an example:
I wonder if it's possible to make a table containing a "text" in the middle of the lines!
Here's an example:
Would that be what you are looking for? link
HTML will look like this:
<div>
<h1><span>Div title</span></h1>
</div>
And CSS, like this:
div{
border: 1px solid #000;
width: 200px;
height: 200px;
}
div h1{
text-align: center;
margin-top: -10px;
height: 20px;
line-height: 20px;
font-size: 15px;
}
div h1 span{
background-color: white;
}
Originally posted here: link
Use fieldset
. The fieldset
tag must necessarily have a legend
child tag, which is its text. It's exactly how you want it, this tag was created for it.
<fieldset>
<legend>Texto</legend>
foo
</fieldset>
Example on JsFiddle . I edited the caption example to be more pro center.
Now just leave the border as you want and be happy. You can also reposition the legend using margins and padding.