自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

這些廢棄的HTML標簽不要用

開發(fā) 前端
HTML 已經(jīng)發(fā)展了多年,現(xiàn)在 W3C 已經(jīng)發(fā)布了 HTML 5.1 的提案推薦標準,一些陳舊廢棄的標簽已經(jīng)在后繼的標準中逐漸消失。這里為大家列出那些已經(jīng)被廢棄 HTML 標簽,看看你是不是還在使用它們。

[[174050]]

HTML 已經(jīng)發(fā)展了多年,現(xiàn)在 W3C 已經(jīng)發(fā)布了 HTML 5.1 的提案推薦標準,一些陳舊廢棄的標簽已經(jīng)在后繼的標準中逐漸消失。這里為大家列出那些已經(jīng)被廢棄 HTML 標簽,看看你是不是還在使用它們。

<acronym>

首字母縮寫,例如 WWW

類似的有<abbr>標簽,表示單詞縮寫,例如 <abbr>inc.</abbr>。語法如下:

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

推薦用<abbr>,不要用<acronym>(忽略上面提到的語義上的差異)。

<applet>

Java 小應用程序,主要提供繪圖功能(在頁面上通過代碼繪制一些東西),例如:

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

目前幾乎沒什么用了,因為運行需要 JRE,而目前主流瀏覽器并不默認安裝 JRE。

推薦使用<canvas>繪圖,或者用<object>+<embed>嵌入 flash代替<applet>。

注意:使用<object>+<embed>是為了更好的兼容性,如果場景允許,推薦使用<object>。

<basefont>

<basefont>標簽定義基準字體。該標簽可以為文檔中的所有文本定義默認字體顏色、字體大小和字體系列,例如:

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

<basefont>標簽只有 IE 支持。

推薦直接給<body>元素定義默認字體,所有子元素都會繼承這些屬性值。

<bgsound>

用來添加背景音樂,例如:

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

推薦使用<audio>或者<object>+<embed>來代替,例如:

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

<big>

用來放大字體,放大一號(嵌套多層可以放大更多),不支持的瀏覽器顯示粗體,例如:

  1. <big>大1號</big><big><big>大2號</big></big> 

至于“號”是怎么定義的就別管了,不推薦使用,建議根據(jù)語義采用<em>、<strong>或者自定義樣式類代替。

<blink>

可以實現(xiàn)閃爍效果,例如:

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

支持性很差,不推薦使用,同樣不推薦使用(各大瀏覽器支持<blink>,但沒有任何效果):

  1. <p>This should be avoided as well.</p> 

建議采用<animation>代替

<center>

使內(nèi)容居中,例如:

  1. <center>文本及子元素會居中</center> 

效果類似于如下 CSS:

  1. text-align: center; 

不建議使用,確實沒有任何理由去用。

<dir>

目錄列表,例如:

  1. <dir> 
  2. <li>html</li>
  3.  <li>xhtml</li> 
  4. <li>css</li>
  5. </dir> 

效果和<ul>基本相同,瀏覽器默認樣式下列表項的左邊距有細微差異。

不推薦使用,建議根據(jù)語義采用<ul>、<ol>或者<dl>。

<font>

用來定義字體、字號和顏色,例如:

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

屬性值和<basefont>一樣。

不推薦使用,建議用 CSS 代替,沒理由用這個標簽。

<frame>

配合<frameset>分欄,例如:

  1. <!DOCTYPE html> 
  2. <html> 
  3. <frameset cols="25%,*,25%"
  4.   <frame src="frame_a.htm"
  5.   <frame src="frame_b.htm"
  6.   <frame src="frame_c.htm"
  7. </frameset> 
  8. </html> 

注意:用<frameset>替換掉<body>。

復雜的后臺頁面會用到<frameset>+<frame>布局,當然也可以采用 float/flex+Ajax 實現(xiàn),根據(jù)具體場景來定。

<frameset>

見<frame>。

<hgroup>

給一系列標題分組,例如:

  1. <hgroup> 
  2.    <h1>The reality dysfunction</h1> 
  3.    <h2>Space is not the only void</h2> 
  4. </hgroup> 

雖然提供了一點語義,但因為已經(jīng)過時,所以不推薦使用。

建議采用<header>代替,例如:

  1. <header> 
  2.    <h1>The reality dysfunction</h1> 
  3.    <p class="subheading">Space is not the only void</p> 
  4. </header> 

<isindex>

單行文本控件,初始顯示prompt屬性值,例如:

  1. <isindex prompt="string" /> 

目前支持性很差,不推薦使用,建議用<input>元素代替。

W3C 建議千萬不要用:

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

具體用法可以參考 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.

<marquee>

滾動字幕,效果很強大,例如:

  1. <marquee bgcolor="#ccffff" vspace="10" direction="up" height="104" width="22.35%" loop="3" scrollamount="1" scrolldelay="10" hspace="20"
  2. <p align="center"><font color="#000000">此處輸入滾動內(nèi)容</font></p></marquee> 
  3. <marquee>這里是輸入文字的地方,還可以放圖片代碼、Flash動畫代碼和gif動態(tài)小圖代碼。</marquee> 

多用來實現(xiàn)公告,雖然已經(jīng)過時了,但效果確實很強大,而且支持性良好。

<multicol>

用來實現(xiàn)多列布局,不建議使用,任何主流瀏覽器都不曾支持過。

MDN 稱其從未被任何主流瀏覽器支持過:

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.

<nextid>

作用未知,支持性未知,不建議使用。

<nobr>

禁止換行,例如:

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

不推薦使用,建議用 CSS 代替:

  1. white-space: nowrap; 

<noembed>

在瀏覽器不支持<embed>時,顯示內(nèi)容,類似于<noscript>,例如:

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

不推薦使用,如果需要考慮兼容性的話,建議采用<object>+<embed>+<noembed>(embed / noembed 作為 object 的回退)。

<noframes>

在瀏覽器不支持<frameset>+<frame>時,顯示內(nèi)容,類似于<noscript>,例如:

  1. <html> 
  2. <frameset cols="25%,50%,25%"
  3.   <frame src="frame_a.htm"
  4.   <frame src="frame_b.htm"
  5.   <frame src="frame_c.htm"
  6.   <noframes>Sorry, your browser does not handle frames!</noframes> 
  7. </frameset> 
  8. </html> 

<noframe>標簽中可以包含任何能夠出現(xiàn)在<body>中的標簽。

如果需要考慮兼容性的話,可以作為<frame>的回退,建議采用 float/flex + Ajax 實現(xiàn),根據(jù)具體場景來定。

<plaintext>

忽略內(nèi)容中的html標簽,作用類似于<pre>,例如:

  1. <p>The markup for this is:</p> 
  2. <plaintext> 
  3.     <h1>Main heading goes here</h1> 
  4.     <p>First paragraph goes here</p> 
  5.     <h2>Sub-heading goes here</h2> 
  6. </plaintext>. 
  7. </body> 
  8. </html> 

不推薦使用,建議根據(jù)語義用<pre>或者<code>代替。

<spacer>

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

  1. <span>Just a text node</span> 
  2. <spacer type="horizontal" size="10"></spacer> 
  3. <span>Just another text node</span> 
  4. <spacer type="block" width="10" height="10"></spacer> 

主流瀏覽器都不支持,不推薦使用。

<strike>

刪除線,效果類似于<del>和<s>,例如:

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

不推薦使用,建議用<del>代替。

<tt>

鍵盤輸入(teletype),例如:

  1. <p><tt>Teletype text</tt></p> 

不推薦使用,建議根據(jù)語義用<kbd>(鍵盤按鍵)、<var>(變量)、<code>(代碼)、<samp>(樣例輸出)或者CSS代替。

<xmp>

80 列的樣例輸出,樣式效果類似于<pre>,語義類似于<samp>,例如:

  1. <xmp> 
  2. Stock ID    Description             Price         Quantity in Stock 
  3. --------    -----------             -----         ----------------- 
  4. 116         Inflatable Armchair     21.50                13 
  5. 119         Walkie Talkie           40.20                44 
  6. </xmp> 

目前瀏覽器支持該標簽,但不限制 80 列。

不推薦使用,建議采用<samp>代替。

責任編輯:龐桂玉 來源: Linux中國
相關推薦

2019-10-12 09:30:48

微信外掛

2023-02-26 15:49:08

元宇宙ChatGPT

2018-03-12 10:57:14

JavaKotlin語法

2015-08-04 08:56:14

swift子類

2021-01-20 07:28:02

nullcollections對象

2020-12-17 10:55:54

SQL數(shù)據(jù)庫語言

2021-01-01 14:37:51

SQL數(shù)據(jù)庫語言

2009-06-05 10:12:36

Struts標簽庫HTML標簽

2023-04-27 13:25:22

索引合并MySQL

2022-04-13 08:43:46

工廠模式接口解析器

2023-12-12 07:16:34

HTML標簽開發(fā)

2015-11-30 11:52:03

云服務最佳實踐

2018-03-15 09:23:24

編程語言程序員Java

2014-08-08 09:36:50

微軟IE

2018-10-17 11:20:55

SQL數(shù)據(jù)庫程序員

2015-03-19 14:53:17

面向?qū)ο?/a>程序員新手程序員

2013-08-16 11:26:24

程序員面向?qū)ο?/a>

2015-01-09 15:22:11

2022-05-31 12:26:50

移動響應css
點贊
收藏

51CTO技術棧公眾號