html常用标签

2020-01-20  本文已影响0人  卡布i

html常用标签

<html><html> 元素 表示一个HTML文档的根(顶级元素),所所以它也被称为根元素。其他所有其他元素必须是此元素的后代。

可用于<head>元素内的元素有:<title>, <base>, <link>, <style>, <meta>, <script>, <noscript>, <command>

标题标签: <h1></h1>~<h6></h6>字体大小依次减小

段落标签:<p></p>

align对齐属性值:

lift: 左对齐 right: 右对齐 center: 居中

justify: 对行进行伸展,每行长度相等

换行标签:

预格式化 标签: <pre></pre>

水平线:


属性:

width: 水平线宽度,像素或百分比

color: 颜色 align: 居中对齐

noshede: 水平线 无阴影

文字斜体: <i></i>,<em></em>

加粗: <b></b>,<strong></strong>

下标: 上标:

下划线: <ins></ins> 删除线:<del></del>

无序列表ul

type属性值:disc圆点 square正方形 circle空心圆

有序列表ol

type属性值:1数字1,2 a小写字母a,b A大写字母A,B i小写罗马字母 I大写罗马字母

定义列表dl

dt定义列表项 dd列表项描述

图片标签img

image.png

alt用于当用户无法查看图像时,alt属性代替在图像显示在网页中

a标签

跳转到同一页面内的位置或者链接网页,邮箱

链接到网址时需要添加http

<a href="javascript:;" target="(_blank空;_self自己;_top顶级;_parent父亲)或者iframe名字 ">QQ</a>

href用法:

1.链接的无协议写法 //qq.com,继承当前页面协议,和ifame一起用

2.#xxx锚点,不跳转页面 ?name=xxx搜索词主动添加到链接后,发起新请求

./xxx.html 相对路径

3.javascript:alert(1)点击后运行js javascript:; 伪协议,点击后什么也不做


image.png image.png image.png
image.png

ifame

iframe标签用于嵌套页面

frameborder="0" 去除iframe默认边框

image.png

form 标签

示例 (http post请求) from表单里用提交按钮提交

提交账号密码到users

<form action="users" method="post">

<input type="text" name="username">

<input type="password" name="password">

<input type="submit" value="提交">

</form>

input / button

区别:是否为「空标签」

button不写type自动升级为submit按钮

submit是唯一确定from能不能提交的按钮

table 标签

用于展示数据

<table></table> 表格 <tr></tr> 行

<td></td> 单元格

<th></th> 表格头,内容加粗 居中

caption:表格标题,居中显示

带结构的表格

thead 放标题 tbody 放数据主体 tfoot 表格脚注

上一篇 下一篇

猜你喜欢

热点阅读