Skip to main content

HTML Tags Not Recommended for Use

Free2015-10-07#HTML#弃用的html标签

Not recommended for use does not mean you don't need to know about them. Some deprecated tags have powerful functions, such as marquee and frame

acronym

Acronym, for example WWW

Similarly there is the abbr tag, representing word abbreviations, for example inc.. Syntax as follows:

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

Recommend using abbr, do not use acronym (ignoring the semantic differences mentioned above)

applet

Java applet, mainly provides drawing functions (drawing something on the page through code), for example:

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

Currently almost useless, because running requires JRE, and currently mainstream browsers do not install JRE by default

Recommend using canvas for drawing, or using object+embed to embed flash instead of applet

Note: Using object+embed is for better compatibility. If the scenario allows, recommend using object

basefont

basefont tag defines the base font. This tag can define default font color, font size, and font family for all text in the document, for example:

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

basefont tag only supported by [IE9-]

Recommend directly defining default font for the body element, all child elements will inherit these attribute values

bgsound

Used to add background music, for example:

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

Recommend using audio or object+embed instead, for example:

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

big

Used to enlarge font, enlarge by one size (nesting multiple layers can enlarge more), unsupported browsers display bold, for example:

<big>Size 1 larger</big><big><big>Size 2 larger</big></big>

As for how "size" is defined, don't worry about it. Not recommended for use, suggest using em, strong or custom style classes based on semantics instead

Can achieve blinking effect, for example:

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

Support is very poor, not recommended for use, also not recommended using (major browsers support blink value, but has no effect):

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

Suggest using animation instead

center

Centers content, for example:

<center>Text and child elements will be centered</center>

Effect similar to CSS:

text-align: center;

Not recommended for use, indeed no reason to use it

dir

Directory list, for example:

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

Effect basically same as ul, under browser default styles list items have slight margin-left differences

Not recommended for use, suggest using ul, ol or dl based on semantics

font

Used to define font, size and color, for example:

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

Attribute values same as basefont

Not recommended for use, suggest using CSS instead, no reason to use this tag

frame

Works with frameset to split columns, for example:

<!DOCTYPE html>
<html>

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

</html>

Note: Use frameset to replace body

Complex backend pages will use frameset+frame layout, of course can also use float/flex+Ajax implementation, depends on specific scenario

frameset

See frame

hgroup

Groups a series of headings, for example:

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

Although provides some semantics, but because already obsolete, so not recommended for use

Suggest using header instead, for example:

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

isindex

Single-line text control, initially displays prompt value, for example:

<isindex prompt="string" />

Currently support is very poor, not recommended for use, suggest using input element instead

W3C suggests absolutely do not use:

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

Quoted from W3C wiki

Specific usage can refer to http://reference.sitepoint.com/html/isindex (hard to find, put here)

listing

Don't worry about what it is, Microsoft does not recommend using it:

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

Quoted from MSDN listing element | listing object

marquee

Scrolling text, effect is very powerful, for example:

<marquee style="height: 104px; width: 22.35%; margin: 10px 20px; background-color: rgb(204, 255, 255);" 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">Enter scrolling content here</font></p></marquee>

<marquee>Enter text here, can also put image code, Flash animation code and gif dynamic small image code.</marquee>

More effects can refer to Moving tag (marquee) attribute detailed explanation

Mostly used to implement announcements, although already obsolete, but effect is indeed very powerful, and support is good

multicol

Used to implement multi-column layout, not recommended for use, any mainstream browser never supported

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.

Quoted from MDN multicol

nextid

Function unknown, support unknown, not recommended for use

nobr

Prevents line breaks, for example:

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

Not recommended for use, suggest using CSS instead:

white-space: nowrap;

noembed

Displays content when browser does not support embed, similar to noscript, for example:

<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>

Not recommended for use, if need to consider compatibility, suggest using object+embed+noembed (embed/noembed as object's fallback)

noframes

Displays content when browser does not support frameset+frame, similar to noscript, for example:

<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 tag can contain any tag that can appear in body

If need to consider compatibility, can be used as frame's fallback, suggest using float/flex+Ajax implementation, depends on specific scenario

plaintext

Ignores HTML tags in content, effect similar to pre, for example:

<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>

Not recommended for use, suggest using pre or code based on semantics instead

spacer

Inserts whitespace, for example:

<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>

Mainstream browsers do not support, not recommended for use

strike

Strikethrough, effect similar to del and s, for example:

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

Not recommended for use, suggest using del instead

tt

Teletype (keyboard input), for example:

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

Not recommended for use, suggest using kbd (keyboard keys), var (variables), code (code), samp (sample output) or CSS based on semantics instead

xmp

80-column sample output, style effect similar to pre, semantics similar to samp, for example:

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

Currently browsers support this tag, but do not limit to 80 columns

Not recommended for use, suggest using samp instead

Comments

No comments yet. Be the first to share your thoughts.

Leave a comment