2011-03-07 12 views
36

¿Puedo hacer como esto en HTML:Haga título frontera en div

Quiero añadir un título frontera ("Información general" en esta imagen) en mi div. ¿Es posible? ¿Cómo hacerlo?


Nota:
La imagen no es la imagen de la página HTML, la imagen es una de Java aplicación.

Respuesta

46
<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> 
+2

¿Es semánticamente correcto usar fieldset para un borde? Me pregunto. – gamov

+0

Plnkr link http://plnkr.co/edit/LpHRzFpEUz2BC5ZN2Q07?p=preview – Abhijeet

11

La imagen es posiblemente usando una etiqueta en lugar de una divfieldset, dentro de un fieldset puede utilizar la etiqueta legend y se posicionará automáticamente allí.

<fieldset> 
<legend>General Information</legend> 
</fieldset> 
+0

Thnx, no la imagen de una página html. Es una imagen de la aplicación Java. –

+0

Veo, tal vez deberías agregar eso a la pregunta. – amosrivera

2
<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> 

Esto le givu u salida como esta.

enter image description here

0

frontera redonda con color de fondo.

<!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> 

Esto le dará una salida como ésta,

enter image description here