Share less-known personalization tags in html

Source: Internet
Author: User
Tags contains mail requires

We know that HTML is a simple markup language, some basic knowledge, the said has been said, the talk has been talked about, no one to pay attention to the HTML and what is new, but it is not, maybe we are familiar with the HTML is very common tags, but for some special tags, You may not be familiar with it and may not be used, but perhaps you will really like them.

  1. Optgroup tags-logical grouping of options in a SELECT element

This element is rarely a concern to us, and few people know what the function of this element is, in fact, this element is usually used in the Select element, and its function is to logically group the options in the SELECT element. This element can be used on many occasions, for example, when we conduct an identity survey for Web visitors, we usually let them fill in the data, in the case of a live city, you may live in Jiangsu Province, you may live in Shandong Province, you may also live in other provinces, there are cities below these provinces, which requires grouping, Group the cities into the provinces. Normally we would write code like this:

<select>
<option selected> your city </option>
<option>------</option> of Shandong Province
<option> Jinan </option>
<option> Laizhou </option>
<option>......</option>
<option>------</option> of Anhui Province
<option> Hefei </option>
<option>......</option>
<option>------</option> of Jiangsu Province
<option> Nanjing </option>
<option>......</option>
</select>

The effect is this:The city where you are------Shandong provinceJinan cityLaizhou......------Anhui provinceHefei city......------Jiangsu provinceNanjing city......  

In fact, this method is very crude, if we use the Optgroup element will achieve a different effect:

<select>
<option selected> your city </option>
<optgroup label= "Shandong Province" >
<option> Jinan </option>
<option> Laizhou </option>
</optgroup>
<optgroup label= "Anhui Province" >
<option> Hefei </option>
<option>......</option>
</optgroup>
<optgroup label= "Jiangsu province" >
<option> Nanjing </option>
<option>......</option>
</optgroup>
</select>

The effect is this:The city where you areJinan cityLaizhou Hefei city..... Nanjing city...... 

This method is not better.

  2, sub mark and SUP tag-the top and bottom subscript settings for a type Object 

A sub tag is an inline element whose function is to display text in the form shown below, slightly smaller than the current font. This element is available in the Internet Explorer 3.0 and above versions of HTML, and is available in the Internet Explorer 4.0 and above scripts. This element requires closing the label.

A common example is when you are editing a mathematical formula, we want to set up the variable, which is the following example:

X<sub>2</sub>
X<sup>2</sup>

The effect is this:

X2

X2

Combined with other tags can be used for annotations, for example:

Mao Zedong <sub><em> Note: Great leaders, revolutionaries, strategists and thinkers </em></sub>

The effect is this:

Mao Zedong Note: The great leaders, revolutionaries, strategists and thinkers  

  3. BDO tag-disables the bidirectional rule for the selected text fragment

Let's take a look at a simple example:

<bdo dir= "ltr" > I love you very much </bdo>

<bdo dir= "RTL" > You love Me not always </bdo>

Note: The BOD label must be used with the Dir label attribute, ltr refers to Left-to-right layout order, RTL refers to Right-to-left layout order.

The results displayed are:

I love you very much

You love me more than I do

We see that a different sort of text becomes the same display result after BDO definition, which is the role of BDO. The Unicode bidirectional algorithm reverses automatically according to the directional characteristics of the character sequence being embedded. For example, the basic orientation of an English document is left to right (LTR). If a paragraph in a document contains a reading order from right to left (RTL), you can apply a bidirectional algorithm to reverse the direction of the language. Bidirectional algorithms and DIR tag properties are usually sufficient to accommodate changes in the embedded direction. However, errors can occur when you put formatted text into a two-way algorithm. For example, an e-mail formatted text segment that contains English and Hebrew will be incorrectly converted by a bidirectional algorithm. Because the Hebrew reading order has already been converted in e-mail format, applying a bidirectional algorithm causes the text to be converted again. The BDO element closes the bidirectional algorithm and controls the reading order. You must use the Dir tag attribute when using the BDO element.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.