哪位大神知道上面表格边框中的文字用HTML怎么做?

如题所述

这个有两种常见方法,

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>


一般表单的这类标题就直接使用标签就可以,具体问题再具体使用不同方法

温馨提示:答案为网友推荐,仅供参考
第1个回答  2017-07-30
: 你这个可以用CSS来控制啊...在fieldset中写入一个CSS样式出来,可以写出你想控制的边框大小,颜色.等
相似回答