html概要

Mar 27, 2017


基础一

windows常用快捷键

sublime中的常用快捷键

标题标签中的h1一个页面中最好只出现一次。原因:和搜索引擎优化SEO有关。

文本格式化标签 文本加粗:strong标签、b标签;工作中推介使用strong;区别:strong有语气强调的作用。chrome中,英文不加粗。 文字倾斜:em标签、i标签;工作中推介使用em;区别:em有语气强调的作用。 删除线标签:del标签、s标签;工作中推介使用del,语义化。 下划线标签:ins标签、u标签;工作中推介使用ins,语义化。

图片标签:alt属性,与浏览器的SEO有关,一般要写好.可以直接用width=“300”,不通过style设置宽高。 等比例缩放 通过title属性设置鼠标移入图片时的提示文字(有延时)。

超链接标签:跳转页面打开方式target属性取值,新窗口_blank,默认_self。 锚点:<p id=”one”>…</p><a href=”#one”></a>。 压缩文件下载:直接把压缩文件(包含路径)写在a标签的href中。 超链接优化写法:页面中添加:,实现所有链接都在新窗口打开。

无序列表:ul,type属性取值:square、disc(默认)、circle。 有序列表:ol,type属性取值:1,a,A,i。从第几个开始,可以用start属性,属性值为阿拉伯数字即可。 自定义列表:dl

embed标签,src属性,hidden属性一般取值true。

滚动:marquee标签

基础二

meta标签: <meta charset=”utf-8”>字符集charset:utf-8通用字符集 <meta name=”keywords” content=”“>网页关键字,和SEO有关 <meta name=”robots” content=”“>网页关键字,和SEO有关,是够可以检索? <meta name=”author” content=”“>网页关键字作者,和SEO有关 <meta name=”description” content=”“>网页描述,给SEO看的,用户也可以看到。 <meta http-equiv=”refresh” content=”5;http://www.baidu.com” >网页重定向,5s后调到百度。

link标签: <link rel=”stylesheet” href=”“> <link rel=”icon” href=”*.ico”>

表格

表格:展示数据

table的属性: border表格边框粗细,默认为0,一般设为1; bordercolor表格边框颜色; cellspacing表格单元格之间的间距,默认取值2,一般设为0; cellpadding单元格内容与边框的距离;
style中,border-collapse: collapse;可以实现细线表格 bgclolr:表格背景; align:center 水平对齐方式取值left(默认)|right|center给table设,表格居中。给tr或td设,单元格内容居中; valign 取值top|middle(默认)|bottom,表格内容垂直对齐方式:

table的标准结构: (浏览器内核解析html中的table时,如果不写tbody一类的,会自动给tr外套一层tbody)

<table border="1" width="500px">
    <caption>表头</caption>
    <thead>
        <tr>
            <th>标题</th>
            <td>标题</td>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>内容</td>
            <td>内容</td>
        </tr>
    </tbody>
    <tfoot>
        <tr>
            <td>哈哈哈</td>
            <td>哈哈哈</td>
        </tr>
    </tfoot>
</table>

表格的单元格合并:colspan、rowspan 表格设置的高度不包括标题caption的高度,但是审查元素时会多出16px的高度,这个是caption的默认高度 。

表格小案例:细线表格,实现思路,给表格设置背景颜色和分割线一致,单元格背景设为白色,单元格间距一像素即可。(利用单元格间距实现的表格分割线)

表单

action:属性,处理信息 method=”get|post”;get是通过地址栏提供(传输)信息,安全性差。post通过1.php来处理信息,安全性高。

input

(样式补充,去掉边框:border:none;去掉获取焦点后的边框:outline-style:none) (label for id 获取光标焦点) 文本输入框 type=”text” maxlength:限制输入字符长度。 readonly=”readonly”:将输入框设置为只读状态。 disabled=”disabled”:输入框未激活状态。 name=”..”:输入框的名称,提交数据时,处理信息识别的属性。 value=”“:输入框内容

密码输入框 type=”password” 文本输入框的所有属性对密码输入框都有效。

单选框 type=”radio” 同一组的选项设置同一个name属性值。 checked=”checked”:设置默认选中项。

多选框 type=”checkbox”

多行文本框 textarea

文件上传控件 type=”file”

下拉列表 selected=”selected”:设置默认选中项。 multiple=”multiple”:设置下拉列表为多选项。

省份:<select name="" id="" multiple>
        <option>北京</option>
        <option>上海</option>
        <option selected="ses">内蒙古</option>
        <option>广州</option>
        <option>山西</option>
        <option>陕西</option>
    </select>

注意:单选框中的checked属性,取值为任意也是checked状态;下拉列表的selected、和multiple用法同上。

按钮 type=”button”; type=”submit”; type=”reset”; <input type=”image” src=”“>图片按钮,可以实现提交功能

表单信息分组:

<fieldset>
    <legend>分组信息</legend>
    性别:<input type="radio" name="gender" value="男" checked="">男
    <input type="radio" name="gender" value="女">女
    <br><br>
    简介:<textarea  cols="12" ></textarea>
</fieldset>
H5中的表单控件
<input type="url"><!--网址控件-->
<input type="time"><!--时间控件-->
<input type="date"><!--日期控件-->
<input type="email"><!--邮件控件-->
<input type="number" step="5"><!--数字控件-->
<input type="range"><!--滑块控件-->







可以不需要style,直接行内设置width的标签img、table,取值的单位px可写可不写