这个有两种常见方法,
1.直接使用标签
<form>
<fieldset>
<legend>用户信息表</legend>
姓名: <input type="text" />
年龄: <input type="text" />
</fieldset>
</form>
2.使用定位,用css控制标题和边框的位置
<style>
*{margin:0;padding: 0}
form{border:1px solid #ccc;display: block;height:200px;padding:20px 10px;margin-
top:100px;position:relative;}/*边框 宽高 内外边距 可根据自己实际情况定义*/
h3{display:inline-block;padding:0 6px;font-size: 14px;height:30px;line-height:30px;position:absolute;left:20px;top:-15px;background: #fff}
</style>
<form>
<h3>用户信息表</h3>
姓名: <input type="text" />
年龄: <input type="text" />
</form>
一般表单的这类标题就直接使用标签就可以,具体问题再具体使用不同方法