HTML comment tag tag and its sub-elements ,

黄舟
Release: 2017-07-17 13:40:18
Original
3096 people have browsed it

There is a small private English learning institution near my home. The foreign teachers hired there are all informal foreign teachers. Almost all the foreign teachers told me that children in English-speaking countries never learn phonetic symbols. They know the words when they see them. pronounce. This surprises us students who must learn English by looking at phonetic symbols. Chinese characters have pinyin, and English also has phonetic symbols for us. Japanese characters and Korean also have phonetic symbols. In Japan, the printing method of marking phonetic symbols on the text is called "Ruby" or "rubi". There is also a tag in HTML that is specially used to display phonetic symbols or comments, which is called ruby. It adopts this attribute from the Japanese printing industry. Of course, there is a programming language also called Ruby, which is two different things, so don’t confuse it.

Example demonstration

HTML comment tag <ruby> tag and its sub-elements <rt>, <rp>

PictureDemonstration:

HTML comment tag <ruby> tag and its sub-elements <rt>, <rp>

ruby syntax description

— Use it to surround text content that requires comments or phonetic symbols.

— Place phonetic symbols or annotations here. This tag should follow the text that needs annotation.

— This tag is used to prevent browsers that do not support ruby ​​tags and is mainly used to place brackets. For browsers that support this tag, the CSS style of the rp tag is {display:none;}, which is invisible.

Code sample

<ruby>
北<rp>(</rp><rt>bei</rt><rp>)</rp>
京<rp>(</rp><rt>jing</rt><rp>)</rp>
</ruby>
Copy after login

The display effect of this code is the effect demonstrated by the above example. The text in

rt will be displayed at the top for horizontally displayed articles. For text displayed vertically, it will appear to the right. If you think the font of the phonetic symbols is too big, you can use CSS to set it to a small font.

The following is a vertical example:

HTML comment tag <ruby> tag and its sub-elements <rt>, <rp>

Browser support

For browsers that do not support ruby ​​tags, rp The content in the mark will be displayed. You can compare the picture below with the picture above to see the difference. The picture below is the display effect in a browser that does not support the ruby ​​tag:

HTML comment tag <ruby> tag and its sub-elements <rt>, <rp>

The latest versions of Firefox, Google and other browsers support this tag.

This tag also supports nested use and displays double-layer annotations.

Use this tag to display Chinese and English text, and the effect is very good.

The above is the detailed content of HTML comment tag tag and its sub-elements , . For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Previous article:Detailed explanation of tag in html5 Next article:Detailed explanation of
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template