美文网首页
HTML常用标签简介

HTML常用标签简介

作者: 基拉巴乔 | 来源:发表于2019-03-05 18:42 被阅读0次

    本文转载自:https://zhuanlan.zhihu.com/p/35692098

    1.<iframe>标签

    一般作为页面嵌套标签来使用:

    image image

    更多关于<iframe>标签的资料请参考MDN:<iframe>

    2.<a>标签

    a标签是英语anchor的缩写,也就是锚点的意思。可以联想为轮船的船锚(那个大大的铁东西)。一般来a标签基本是作为超链接,锚点来使用。

    超链接:

    <a href="链接路径">文字</a>

    a标签里面有4个属性分别是:_blank _*self *_parent _top

    他们主要决定为当前设置链接打开窗口的方式:

    以_blank为例:

    image image

    <figcaption style="margin-top: calc(0.666667em); padding: 0px 1em; font-size: 0.9em; line-height: 1.5; text-align: center; color: rgb(153, 153, 153);">点击_blank,直接新建一个窗口打开</figcaption>


    _self:

    image image image

    <figcaption style="margin-top: calc(0.666667em); padding: 0px 1em; font-size: 0.9em; line-height: 1.5; text-align: center; color: rgb(153, 153, 153);">_self:为当前窗口打开链接</figcaption>


    _parent:

    image image

    <figcaption style="margin-top: calc(0.666667em); padding: 0px 1em; font-size: 0.9em; line-height: 1.5; text-align: center; color: rgb(153, 153, 153);">HTML续是htmldemo的父元素</figcaption>

    image image image

    _parent属性必须配合iframe标签使用才能看出效果:

    图一是图二的父元素,所以是在父元素窗口打开。差不多属性的还有一个top属性,_top属性就是在祖先元素打开,只要捋好了各自之间的元素关系,相信要使用好这两个标签并不难。


    a标签还有一个锚点的属性:

    锚:锚点的作用是页面内的跳转,没有发起请求。

    <a href="#mao" target="_self">点击此处到目标位置</a>

    <a name="mao" target="_self">目标位置</a>

    image

    <figcaption style="margin-top: calc(0.666667em); padding: 0px 1em; font-size: 0.9em; line-height: 1.5; text-align: center; color: rgb(153, 153, 153);">当我点击:时,就会在当前页面跳转至目标位置这一栏。</figcaption>


    2:<form>标签:跳转页面,上传内容

    a跳转页面是get请求,form跳转页面是post请求。

    如果form表单里面没有提交按钮,那么你就没法提交

    form标签,主要是用来发起post请求

    你在name上输出的东西,最终会引入到请求第四部分

    firl协议不支持post

    get:获取内容 form:上传内容

    一般用于新用户注册


    3.<input>:

    <input> 一般用于为基于Web的表单创建交互式控件,以便接受来自用户的数据:

    input有众多属性,以下就跳最常用的"文本框"属性来说

    图下的代码是用input创建一个简单的文本框:

    image

    <figcaption style="margin-top: calc(0.666667em); padding: 0px 1em; font-size: 0.9em; line-height: 1.5; text-align: center; color: rgb(153, 153, 153);">type="text" 一个文本框 value=设置input里面的初始文字</figcaption>

    image

    more:input


    4:<button>:

    **<button> **表示一个可点击的按钮,可以用在表单或文档其它需要使用简单标准按钮的地方。 默认情况下,HTML按钮的显示样式接近于 user agent 所在的宿主系统平台(用户操作系统)的按钮, 但你可以使用 CSS 来改变按钮的样貌。

    语法示例:

    image image

    button与input:

    <button><input type="button"> 的具体区别

    1、关闭标签设置。<input>禁用关闭标签</input>。闭合的写法:<input type="submit" value="OK" />。

    <button>的起始标签和关闭标签都是必须的,如 <button>OK</button>。

    2、<button>的值并不是写在value属性里,而是在起始、关闭标签之间,如上面的OK。同时<button>的值很广泛,有文字、图像、移动、水平线、框架、分组框、音频视频等

    3、可为button元素添加CSS样式。

    例如,<button style="width:150px;height:50px;border:0;"></button>

    其中:width:150px;height:50px; 为按钮的宽度、高度, 为按钮的背景色,

    border:0; 是去掉默认的边框。


    5:<table>:

    table 元素表示表格数据 — 即通过二维数据表表示的信息。

    <table>的几个简单属性:

    tfoot 表脚

    tr=table row行

    td=数据 table data,数据放在td里面

    colgroup=控制列宽度

    更多属性应用可参考:<table>

    image

    <figcaption style="margin-top: calc(0.666667em); padding: 0px 1em; font-size: 0.9em; line-height: 1.5; text-align: center; color: rgb(153, 153, 153);">以上就是table标签的示例应用,可以看作是一个word文档,横行tr纵列td,然后设置border实线</figcaption>

    相关文章

      网友评论

          本文标题:HTML常用标签简介

          本文链接:https://www.haomeiwen.com/subject/twnouqtx.html