Give border title in div

HtmlCssForms

Html Problem Overview


Can I do like this in HTML:

enter image description here

I want to add border title ("General Information" in this image) on my div. Is it possible? How to do it?


Note:
The image is not HTML page's image, its a Java app's image.

Html Solutions


Solution 1 - Html

<div id="form" style="width:350px;">
   <fieldset>
      <legend style="color:blue;font-weight:bold;">General Information</legend>
	  <table>
	     <tr>
            <td><span style="text-decoration:underline">C</span>hange Password To:</td>
            <td><input type="text"/></td>
         </tr>
         <tr>
	        <td><span style="text-decoration:underline">C</span>onfirm Password:</td>
	        <td><input type="text"/></td>
	     </tr>
	  </table>
   </fieldset>
</div>

Solution 2 - Html

The image is possibly using a fieldset tag instead of a div, inside a fieldset you can use the tag legend and it will automatically position there.

<fieldset>
<legend>General Information</legend>
</fieldset>

Solution 3 - Html

<fieldset style="width:100px;">

<legend>

Please Enter Your Name</legend>

<br>

<table>

<tr>

<td>First Name:</td>

<td><input type="text" /></td>

</tr>

<tr>

<td>Last Name:</td>

<td><input type="text" /></td>

</tr>

</table>

</fieldset>

This will givu u output like this.

enter image description here

Solution 4 - Html

Round Border with Background color.

<!DOCTYPE html>
<html>
<head>
<style> 
.sample
{
border:2px solid #a1a1a1;
padding:10px 40px; 
background:#dddddd;
width:300px;
border-radius:25px;
}
</style>
</head>
<body>

<div class="sample">
The border-radius property allows you to add rounded corners to elements.

<fieldset style="width:100px;">

<legend>

Please Enter Your Name</legend>

<br>

<table>

<tr>

<td>First Name:</td>

<td><input type="text" /></td>

</tr>

<tr>

<td>Last Name:</td>

<td><input type="text" /></td>

</tr>

<tr>

<td>First Name:</td>

<td><input type="text" /></td>

</tr>

<tr>

<td>Last Name:</td>

<td><input type="text" /></td>

</tr>

</table>

<input type="submit" value="Submit">


</fieldset>

</div>
</body>
</html>

This will give output like this,

enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionHarry JoyView Question on Stackoverflow
Solution 1 - Htmluser554180View Answer on Stackoverflow
Solution 2 - HtmlamosriveraView Answer on Stackoverflow
Solution 3 - HtmlRudrikView Answer on Stackoverflow
Solution 4 - HtmlKannan ArumugamView Answer on Stackoverflow