博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Web前端之html_day2
阅读量:7286 次
发布时间:2019-06-30

本文共 2720 字,大约阅读时间需要 9 分钟。

1meta标签

1
2
3
<
metacharset
=
"UTF-8"
/>
<
metaname
=
"Keywords"
content
=
" "
/>
<
meta
name
=
'Description'
content
=
" "
/>

    Charset:指定当前文档编码格式

    Keywords:表示关键字,对搜索引擎友好,实现网站推广

    Description:表示网站描述,网站优化

2、表格

1
2
3
4
5
<
table
width
=
'30px'
height
=
'60px'
border
=
'1'
cellpadding
=
'0'
> 定义一个表格
        
<
tr
>            定义行
            
<
td
></
td
>定义列
        
</
tr
>
</
table
>

     width:  设置宽度

    height: 设置高度

    border: 设置边框

    cellpadding:    设置文字与列(td)之间的距离

    cellspacing:    设置列与列之间的距离(默认为2)

    align='center'  给表格设置,让表格居中,给列设置,让文字居中

    <th></th>   设置表格内容标题,用法和td用法是一样的

    bgcolor     设置表格背景颜色

    <caption></caption>     给表格加标题

    

    

    table结构:

1
2
3
4
5
<
table
>
      
<
thead
></
thead
>
      
<
tbody
></
tbody
>
      
<
tfoot
></
tfoot
>
</
table
>

    如果按照结构去写表格,就一定要按照顺序去写

    

3、表单

    作用:搜索用户信息

 属性:action/method

    action 指定处理表单信息的程序

    method get或者post  指的是表单的提交方式

    get:讲我们的表单信息暴漏在地址栏中(安全性差)

    post:通过后台方式提交给处理程序(安全性比较高)

    表单结构:

1
2
3
<
form
>
     
表单控件
</
form
>

    表单控件:

      a、文本框<inputtype="text">

1
2
3
4
5
6
7
<
form
action
=
"1.php"
method
=
"post"
>
       
<
input
type
=
"text"
name
=
"username"
maxlength
=
"3"
readonly
=
"readonly"
>
               
maxlength:设置最大长度
               
readonly="readonly":只读(此时表单不能输入信息)
       
<
input
type
=
"text"
name
=
"username"
maxlength
=
"6"
disabled
=
"disabled"
>
               
disabled="disabled" 控件未激活(此时表单不能输入信息)
</
form
>

       b、密码框  <inputtype="password">

             <input type="password">                             

          c、单选框<input type="radio">

1
2
3
4
<
form
action
=
"1.php"
method
=
"post"
>
       
<
inputtype
=
"radio"
name
=
"xingbie"
>男
       
<
inputtype
=
"radio"
name
=
"xingbie"
checked
=
"checked"
>女 ​   # checked="checked"设置默认选中
</
form
>

      d、多选框 <inputtype="checkbox">

1
2
3
4
<
inputtype
=
"checkbox"
checked
=
"checked"
>看书
<
inputtype
=
"checkbox"
>上网
<
input
type
=
"checkbox"
>旅游
<
inputtype
=
"checkbox"
checked
=
"checked"
>学习

       e、下拉列表框

       <select></select>这是下拉列表框

1
2
3
4
5
<
select
>
     
<
option
>北京</
option
>
     
<
option
>上海</
option
>
     
<
option
>河南</
option
>
</
select
>

       下拉列表分组显示

1
2
3
4
5
6
7
<
select
>
     
<
optgrouplabel
=
"上海"
>
          
<
option
>松江区</
option
>
          
<
option
>闵行区</
option
>
          
<
option
>徐汇区</
option
>
     
</
optgroup
>
</
select
>

       属性:multiple="multiple"  实现多选效果

 属性:selected="selected" 设置下拉列表框实现默认选中

1
2
3
4
5
<
selectmultiple
=
"multiple"
>
       
<
option
>北京</
option
>
       
<
option
>安徽</
option
>
       
<
optionselected
=
"selected"
>上海</
option
>
</
select
>

      f、多行文本框  <textarea></textarea>

           属性:  cols="30"   用法效果和width一样

                     rows="10"   用法效果和height一样

           介绍自己

1
2
3
<
textareacols
=
"30"
rows
=
"60"
>
        
介绍内容
</
textarea
>

      g、上传控件

           <inputtype="file">

    三种按钮:

        h、普通按钮

           <input type="button" value="确定">

           注意:此按钮和js配合使用

       i、重置按钮(将表单中的数据恢复到默认值)

           <inputtype="reset">

       j、提交按钮

         <input type="submit">

          <input type="image"src="Hydrangeas.jpg"> 此按钮和submit按钮都可以提交表单

       k、表单分组控件:<fieldset></fieldset>

1
2
3
4
5
<
fieldset
>
    
<
legend
>人员注册信息</
legend
>
    
<
label
>姓名:</
label
>
    
<
label
>年龄:</
label
>
</
fieldset
>

        

转载于:https://www.cnblogs.com/opsedu/p/5488749.html

你可能感兴趣的文章
数据结构-线性表操作
查看>>
5Python全栈之路系列之算法
查看>>
一个效果不错的Java Swing模拟屏幕截图工具类
查看>>
MySQL 的主从复制
查看>>
把合同中红色印章实现打印不显示方法
查看>>
linux调优工具使用
查看>>
php.ini中开启段标签
查看>>
php-扩展编译安装扩展(通用版)
查看>>
信号槽的实现实例—— Qt 和 Boost
查看>>
一段简单的php翻页代码
查看>>
AMD峰会:AMD继续领先intel 并走在节能前沿
查看>>
MySQL第三方复制工具 --- Tungsten-Replicator
查看>>
软件平台与框架的生命周期
查看>>
mysql 引擎MyISAM 和 InnoDB区别
查看>>
Docker(二十)在 Kubernetes 中配置私有 DNS 和上游域名服务器
查看>>
AIX 6.1 + HACMP 6.1 + Oracle 11g双机实施 (1) --- AIX 6.1配置HACMP 6.1
查看>>
我的友情链接
查看>>
mysqldump 使用
查看>>
做最好的自己,人生十件事(事业,人生,情感)
查看>>
jboss 优化
查看>>