day14-Html的body内标签之label 、fieldset

二话不说开搞,

1、label 标签

作用:用for属性关联input标签的id属性,这样点击文件,使得关联的标签获取光标

1   <label for="i1">用户名:</label>
2     <input type="text" id="i1">

效果:

点击 “用户名” 文本框中 获取了光标,

2、fieldset 标签

2.1 这个标签很少用到,作用主要是显示出一个框的,基本用不到,我们看一下效果。

1
2
3
4
5
<body>
    <fieldset>  #fieldset配合着legend使用
        <legend>登录</legend>
    </fieldset>
</body>

效果图:

2.2 、fieldset  一般和 label 配合使用,如下面例子

 

 1 <body>
 2     <fieldset>
 3         <legend>登陆</legend>
 4         <label for="user">用户名:</label>
 5         <input type="text" id="user">
 6         <br>
 7         <label for ="password">密码:</label>
 8         <input type="password" id="password">
 9     </fieldset>
10 
11 </body>

 

效果:

 

posted @ 2018-05-16 17:32  东郭仔  阅读(161)  评论(0)    收藏  举报