美文网首页
九、html中常用标签

九、html中常用标签

作者: Lichee_3be1 | 来源:发表于2018-03-28 10:00 被阅读0次

    1、iframe内联框架元素,将另一个页面嵌入到当前页面中

    <iframe src="https://www.baidu.com"></iframe>
    (嵌套百度页面,src可用相对路径,如./index.html,然后就在嵌套页面中显示这个文件里面的内容了)

    <iframe name="xxx" src="#" ></iframe>
    <a target="xxx" href="https://www.baidu.com">百度</a>
    这个时候点击百度,会在当前嵌套的空白页面中打开这个a中的href,target指向的xxx对应的name为xxx的嵌套页面

    其他属性:比如frameborder=0

    2、<a> 跳转页面(HTTP GET 请求)

    打开页面:

    <a target="xxx" href="https://www.baidu.com" >百度</a>
    在name="xxx"的iframe中打开

    <a target="_blank" href="https://www.baidu.com">百度</a>
    在新的页面打开

    <a target="_self" href="https://www.baidu.com">百度</a>
    在自己所在的页面打开

    <a target="_parent" href="https://www.baidu.com">百度</a>
    在父页面打开,如果自己是被嵌套到里面的,一般是直接引入这个页面的

    <a target="_top" href="https://www.baidu.com">百度</a>
    最高级的页面中

    下载:

    <a href="http://baidu.com" download>下载</a>
    当content-type:text/html时候可以直接强制性的加上download
    或者在http响应中加上content-type:aplication/octet-stream

    href:

    href="baidu.com"是不可以的,因为会直接把它当成一个当前目录下面的文件,毕竟后缀com又不一定要是网页
    href="http://baidu.com'可以,表示http协议,然后域名是baidu.com
    href="https://baidu.com支持的话也ok
    href="//baidu.com'无协议绝对地址,一般默认当前的协议
    href="xxx.html“,会直接到/xxx.html
    href="?name=lichee'ok,也加到当前页面链接后面,发起请求
    href="",自我刷新
    href=”JavaScript:"伪协议,需要一个a标签却不能做任何事情
    href="#xxx",会动一下子,只有锚点不发起请求

    <a name="#tip">创建了个书签</a>
    <a href="#tips">调到书签处</a>

    3、form 跳转页面(HTTP POST 请求),form中没有加提交按钮submit就无法提交

    action对应a标签的href
    <form action="index.html" method="post"><input type="submit" value="提交”></form>

    我们可以改成<form action="user?zzz=xxl" method="post">把你写的参数从之前的第四部分变成放在查询参数中
    注意a标签只能get不可能有第四部分,一直是查询参数

    4、按钮
    <button>button</button>会自动升级成提交按钮
    <button type=“button”>button</button>就不能正常提交了
    <input type="button" value="提交”>也不能
    <input type="submit" value="提交”>
    <input type="reset" value="重置”>

    input结合lable标签使用,点那个字就可在框框里面输东西
    文本框:

    <label>用户名<input type="text" name="text"><label>
    <label>密码<input type="password" name="password"><label>
    

    多选框:(name保证服务器知道你们是同个问题)

    <label><input type="checkbox"  name="hobby" value="programming">编程</label>
    <label><input type="checkbox"  name="hobby" value="sleeping">睡觉</label>
    

    单选框:(出来服务器方面,这里的Nane还保证了多选一)

    <label><input type="radio"  name="gender" value="woman">编程</label>
    <label><input type="radio"  name="gender" value="man">睡觉</label>
    

    5、select #make a drop-down list(下拉的那种选择列表)

    <select name="group">
        <option value="">-</option>(空的分组)
        <option value="1">第一组</option>
        <option value="2">第二组</option>
    </select>
    

    6、textarea #make a text area(多行文本框)

    <textarea  style="resize:none;width:100px;height:100px; name="爱好“></textarea>
    

    7、table


    image.png

    colgroup可以设置表格总体的一些属性
    分成thead,tbody,tfoot三个属性
    然后tr一行,th放内容,td放内容的数据
    collapse把空隙给消掉了

    8、其他
    em表示语气重,strong意义强调
    div和span不可以当head的儿子
    <div contenteditable>你好</div> #contenteditable意味着可以编辑你好啦
    划分块时候,一般因为后面要应用css,而css只能纵向或者横向,所以用div切块块要注意这个。
    用section就像课文1和2,而div是语文课文1中的划段落
    ol有序列表,ul无序列表,下面的一行行用li标签表示其内容
    p表示段落,但是一组p标签内换行只显现出一个空格,应该用


    水平线
    <a href=”mailto(自动调用默认的客户端电子邮件服务):收件人1地址;收件人2地址等等 ?(mailto后面多个参数,第一个用?开头,后面的用&分隔开)>
    <h1>到h6,标题越来越小

    <pre>直接输出这个标签内的文本,空格什么的都不要变化
    <del>划掉我呀</del>,字体上面画了一条线,表示删除
    <ins>下划线文本
    <abbr title="woaini">wan</abbr>,缩略词,把鼠标放上面可以看见title内容
    <adress>表示居住地址,斜体
    <div>是没有意义的标签,一般和class连用

    相关文章

      网友评论

          本文标题:九、html中常用标签

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