Discussion Forum

Main >> HTML/CSS Technical Articles and Discussions>> How to place text labels over a div border

All Threads Register Login New Discussion
AuthorPostings
tbrussel
Programmer
How to place text labels over a div border

Tuesday, August 15 2006 04:13 PM

I am trying to lay text labels over the border of a div so they look nice but using positioning does not work well in all browsers.

Any ideas?

Post a Replyreply

AlexT
Developer
Re:How to place text labels over a div border

Tuesday, August 15 2006 04:15 PM

<fieldset>
<legend>Label Here</legend>
<div class="someclass"><p>E-mail</p>
<input type="text" id="e-mail" />
</div>
</fieldset>

Post a Replyreply

Navrang Prayag
web designer
How to place text labels over a div border

Tuesday, June 02 2015 01:47 AM

You can use the following HTML:

<div>
<h1><span>Div title</span></h1>
</div>
With the following CSS:

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;
}

Post a Replyreply

AT Integrated Inc. | 913 Ridgebrook Rd Suite 109, Sparks, MD 21152 | T: 410-472-2490
Copyright © 2024 AT Integrated Inc. All rights reserved.