• 那些不推荐使用的html标签


    acronym

    首字母缩写,例如WWW

    类似的有abbr标签,表示单词缩写,例如inc.。语法如下:

    <acronym title="World Wide Web">WWW</acronym>
    <abbr title="incorporated">inc.</abbr>
    

    推荐用abbr,不要用acronym(忽略上面提到的语义上的差异)

    applet

    Java小应用程序,主要提供绘图功能(在页面上通过代码绘制一些东西),例如:

    <applet code="ShowImage.class" width=600 height=400 archive="Imagetest.jar"></applet>
    

    目前几乎没什么用了,因为运行需要JRE,而目前主流浏览器并不默认安装JRE

    推荐使用canvas绘图,或者用object+embed嵌入flash代替applet

    注意:使用object+embed是为了更好的兼容性,如果场景允许,推荐使用object

    basefont

    basefont标签定义基准字体。该标签可以为文档中的所有文本定义默认字体颜色、字体大小和字体系列,例如:

    <basefont color="red" size="5" face="Arial" />
    

    basefont标签只有[IE9-]支持

    推荐直接给body元素定义默认字体,所有子元素都会继承这些属性值

    bgsound

    用来添加背景音乐,例如:

    <bgsound src="your.mid" autostart="true" loop="infinite">
    

    推荐使用audio或者object+embed来代替,例如:

    <embed src="your.mid" autostart="true" loop="true" hidden="true">
    

    big

    用来放大字体,放大一号(嵌套多层可以放大更多),不支持的浏览器显示粗体,例如:

    <big>大1号</big><big><big>大2号</big></big>
    

    至于“号”是怎么定义的就别管了,不推荐使用,建议根据语义采用em、strong或者自定义样式类代替

    blink

    可以实现闪烁效果,例如:

    <blink>Why would somebody use this?</blink>
    

    支持性很差,不推荐使用,同样不推荐使用(各大浏览器支持blink值,但没有任何效果):

    <p style="text-decoration: blink">This should be avoided as well.</p>
    

    建议采用animation代替

    center

    使内容居中,例如:

    <center>文本及子元素会居中</center>
    

    效果类似于CSS:

    text-align: center;
    

    不建议使用,确实没有任何理由去用

    dir

    目录列表,例如:

    <dir>
        <li>html</li>
        <li>xhtml</li>
        <li>css</li>
    </dir>
    

    效果和ul基本相同,浏览器默认样式下列表项的左边距有细微差异

    不推荐使用,建议根据语义采用ul、ol或者dl

    font

    用来定义字体、字号和颜色,例如:

    <font face="verdana" color="green" size="3">This is some text!</font>
    

    属性值和basefont一样

    不推荐使用,建议用CSS代替,没理由用这个标签

    frame

    配合frameset分栏,例如:

    <!DOCTYPE html>
    <html>
    
    <frameset cols="25%,*,25%">
      <frame src="frame_a.htm">
      <frame src="frame_b.htm">
      <frame src="frame_c.htm">
    </frameset>
    
    </html>
    

    注意:用frameset替换掉body

    复杂的后台页面会用到frameset+frame布局,当然也可以采用float/flex+Ajax实现,根据具体场景来定

    frameset

    见frame

    hgroup

    给一系列标题分组,例如:

    <hgroup>
       <h1>The reality dysfunction</h1>
       <h2>Space is not the only void</h2>
    </hgroup>
    

    虽然提供了一点语义,但因为已经过时,所以不推荐使用

    建议采用header代替,例如:

    <header>
       <h1>The reality dysfunction</h1>
       <p class="subheading">Space is not the only void</p>
    </header>
    

    isindex

    单行文本控件,初始显示prompt值,例如:

    <isindex prompt="string" />
    

    目前支持性很差,不推荐使用,建议用input元素代替

    W3C建议千万不要用:

    No, really, don’t use it. This element is deprecated. It is not implemented anymore.

    引自W3C wiki

    具体用法可以参考http://reference.sitepoint.com/html/isindex(很难找,放在这里)

    listing

    不用管它是什么,微软都不建议使用了:

    This element is obsolete and should no longer be used. Use HTMLPreElement, code or CSS instead. Renders text in a fixed-width font.

    引自MSDN listing element | listing object

    marquee

    滚动字幕,效果很强大,例如:

    <marquee style="height: 104px;  22.35%; margin: 10px 20px; " bgcolor="#ccffff" vspace="10" direction="up" height="104" width="22.35%" loop="3" scrollamount="1" scrolldelay="10" hspace="20">
    <p align="center"><font color="#000000">此处输入滚动内容</font></p></marquee>
    
    <marquee>这里是输入文字的地方,还可以放图片代码、Flash动画代码和gif动态小图代码。</marquee>
    

    更多效果可以参考移动标签(marquee)属性详解

    多用来实现公告,虽然已经过时了,但效果确实很强大,而且支持性良好

    multicol

    用来实现多列布局,不建议使用,任何主流浏览器都不曾支持过

    The HTML element was an experimental element designed to allow multi-column layouts. It never got any significant traction and is not implemented in any major browsers.

    引自MDN multicol

    nextid

    作用未知,支持性未知,不建议使用

    nobr

    禁止换行,例如:

    <p>Our telephone number is <nobr>0800 123 123 123</nobr>.</p>
    

    不推荐使用,建议用CSS代替:

    white-space: nowrap;
    

    noembed

    在浏览器不支持embed时,显示内容,类似于noscript,例如:

    <noembed>
    <img src="/images/inflate.jpg" alt="Inflate the tyre by holding the
    pump at 90 degree angle to the valve">
    <p>You can inflate the tyre by holding the pump at 90 degree angle
    to the valve, as shown in the image above.</p>
    </noembed>
    

    不推荐使用,如果需要考虑兼容性的话,建议采用object+embed+noembed(embed/noembed作为object的fallback)

    noframes

    在浏览器不支持frameset+frame时,显示内容,类似于noscript,例如:

    <html>
    
    <frameset cols="25%,50%,25%">
      <frame src="frame_a.htm">
      <frame src="frame_b.htm">
      <frame src="frame_c.htm">
      <noframes>Sorry, your browser does not handle frames!</noframes>
    </frameset>
    
    </html>
    

    noframe标签中可以包含任何能够出现在body中的标签

    如果需要考虑兼容性的话,可以作为frame的fallback,建议采用float/flex+Ajax实现,根据具体场景来定

    plaintext

    忽略内容中的html标签,作用类似于pre,例如:

    <p>The markup for this is:</p>
    <plaintext>
        <h1>Main heading goes here</h1>
        <p>First paragraph goes here</p>
        <h2>Sub-heading goes here</h2>
    </plaintext>.
    
    </body>
    </html>
    

    不推荐使用,建议根据语义用pre或者code代替

    spacer

    插入空白(white spaces),例如:

    <span>Just a text node</span>
    <spacer type="horizontal" size="10"></spacer>
    <span>Just another text node</span>
    <spacer type="block" width="10" height="10"></spacer>
    

    主流浏览器都不支持,不推荐使用

    strike

    删除线,效果类似于del和s,例如:

    <p>Version 2.0 is <strike>not yet available!</strike> now available!</p>
    

    不推荐使用,建议用del代替

    tt

    键盘输入(teletype),例如:

    <p><tt>Teletype text</tt></p>
    

    不推荐使用,建议根据语义用kbd(键盘按键)、var(变量)、code(代码)、samp(样例输出)或者CSS代替

    xmp

    80列的样例输出,样式效果类似于pre,语义类似于samp,例如:

    <xmp>
    Stock ID    Description             Price         Quantity in Stock
    --------    -----------             -----         -----------------
    116         Inflatable Armchair     21.50                13
    119         Walkie Talkie           40.20                44
    </xmp>
    

    目前浏览器支持该标签,但不限制80列

    不推荐使用,建议采用samp代替

    那些不推荐使用的html标签

  • 相关阅读:
    loadrunner上传文件到网盘
    robotframework + appium 获取android toast
    jmeter 签名MD5生成
    python appium 封装获取toast方法
    java appium客户端 6.1.0android长按及滑动变更
    父类与子类 构造函数 变量 加载顺序
    检测安卓手机联网方式
    context menu与submenu区别
    div 居中
    ndk的一些概念
  • 原文地址:https://www.cnblogs.com/shiddong/p/5963167.html
Copyright © 2020-2023  润新知