Home > Web Front-end > H5 Tutorial > body text

Xiaoqiang's road to HTML5 mobile development (13) - Global attributes in HTML5

黄舟
Release: 2017-01-22 11:38:07
Original
1633 people have browsed it

1. accssskey shortcut key

<!DOCTYPE HTML>  
<html>  
<body>  
  
<a href="http://blog.csdn.net/column/details/dawanganban-html5.html" accesskey="w">小强的HTML5移动开发之路</a><br />  
<a href="http://blog.csdn.net/column/details/android-growup.html" accesskey="g">Android菜鸟的成长笔记</a>  
  
<p><b>注释:</b>请使用 Alt + <i>accessKey</i> 来访问带有快捷键的元素。</p>  
  
</body>  
</html>
Copy after login

Xiaoqiangs road to HTML5 mobile development (13) - Global attributes in HTML5

Interested friends can hold down Alt + g and Alt + w to try it

Xiaoqiang’s HTML5 mobile Development Road
Android Novice’s Growth Notes

Note: Please use Alt + accessKey to access elements with shortcut keys.

This tag has no difference between HTML4 and HTML5.

2. The class attribute specifies the element class name

<!DOCTYPE HTML>  
<html>  
<head>  
<style type="text/css">  
h1.intro {color:blue;}  
p.important {color:green;}  
</style>  
</head>  
<body>  
  
<h1 class="intro">Header 1</h1>  
<p>A paragraph.</p>  
<p class="important">请注意这个重要的段落。:)</p>  
  
</body>  
</html>
Copy after login

Xiaoqiangs road to HTML5 mobile development (13) - Global attributes in HTML5

3. The contenteditable attribute specifies whether the content of the element can be edited

<!DOCTYPE HTML>  
<html>  
<body>  
  
<p contenteditable="true">这是一段可编辑的段落。请试着编辑该文本。</p>  
  
</body>  
</html>
Copy after login

This is an editable paragraph. Please try editing the text.

The contenteditable attribute is a new attribute in Html5

4. The contextmenu attribute specifies the context menu for the element. This menu will appear when the user right-clicks on the element

Currently no major browser supports the contextmenu attribute.

<!DOCTYPE html>  
<html>  
<body>  
  
<p contextmenu="supermenu">本段落拥有一个名为 "supermenu" 的上下文菜单。这个菜单会在用户右键单击该段落时出现。</p>    
  
<menu id="supermenu">  
  <command label="Step 1: Write Tutorial" onclick="doSomething()">  
  <command label="Step 2: Edit Tutorial" onclick="doSomethingElse()">  
</menu>  
  
<p><b>注释:</b>目前的主流浏览器都不支持 contextmenu 属性。</p>  
  
</body>  
</html
Copy after login

5. The dir attribute specifies the text direction of the element content.

<p dir="rtl">Write this text right-to-left!</p>
Copy after login

Value Description

ltr Text direction from left to right.

rtl Text direction from right to left.

auto Let the browser determine the text direction based on the content. Recommended only when text orientation is unknown.

6. The draggable attribute specifies whether the element can be dragged.

Value Description

#true Specifies that the element is draggable.

false Specifies that the element is not draggable.

auto Use the browser's default features.

Currently only Firefox, Chrome and Safari support the draggable attribute.

7. The dropzone attribute specifies whether the dragged data will be copied, moved or linked when it is dragged and dropped on the element.

Currently no major browser supports the dropzone attribute.

8. The hidden attribute specifies that the element is hidden.

The hidden attribute is a new attribute in HTML5.

9. The id attribute specifies the unique id of the HTML element

<html>  
<head>  
<script type="text/javascript">  
function change_header()  
{  
document.getElementById("myHeader").innerHTML="Nice day!";  
}  
</script>  
</head>  
  
<body>  
<h1 id="myHeader">Hello World!</h1>  
<button onclick="change_header()">改变文本</button>  
</body>  
  
</html>
Copy after login

10. The lang attribute specifies the language of the element content.


ISO 639-1 defines abbreviations for various languages. You can use them in the lang and xml:lang attributes in HTML and XHTML.

Language

ISO Code

Abkhazian ab

Afar aa

Afrikaans af

Albanian sq

Amharic am

Arabic ar

Armenian hy

Assamese as

Aymara ay

Azerbaijani az

Bashkir ba

Basque eu

Bengali (Bangla) bn

Bhutani dz

Bihari bh

Bislama bi bi

Breton br

Bulgarian bg

Burmese my

Byelorussian (Belarusian) be

Cambodian km

Catalan ca

Cherokee

Chewa

Chinese (Simplified) zh

Chinese (Traditional) zh

Corsican co  

Croatian   hr  

Czech   cs  

Danish   da  

Divehi    

Dutch     nl  

Edo  

English en

Esperanto eo

Estonian et

Faeroese fo

Farsi fa

Fiji fj

Finnish fi  

Flemish  

French   fr  

Frisian   fy  

Fulfulde  

Galician   gl  

Gaelic (Scottish) gd

Gaelic (Manx) gv

Georgian ka

German de

Greek el

Greenlandic kl

Guarani gn  

Gujarati gu  

Hausa   ha  

Hawaiian  

Hebrew   he, iw  

Hindi   hi  

Hungarian hu

Ibibio

Icelandic is

Igbo

Indonesian id, in

Interlingua ia

Interlingual ie

Inuktitut iu

I speak

Irish ga

Italian it

Japanese and

Javanese jv

Kannada kn

Kanuri

Kashmiri ks

Kazakh kk

Kinyarwanda (Rwanda) rw

Kirghiz ky

Kirundi (Rundi) rn

Konkani

Korean is

Kurdish is

Laothian is not

Latin la

Latvian (Lettish) lv

Limburgish ( Limburger) li

Lingala ln

Lithuanian lt

Macedonian mk

Malagasy mg

Malay ms

Malayalam ml

Maltese mt

Maori mi

Marathi mr

Moldavian mo

Mongolian mn

Nauru and

Nepali and

Norwegian no

Occitan oc

Oriya or

Oromo (Afan, Galla) om

Papiamentu

Pashto (Pushto) ps

Polish pl

Portuguese pt

Punjabi pa

Quechua qu

Rhaeto-Romance rm

Romanian ro

Russian ro

Sami (Lappish)

Samoan sm

Sangro sg

Sanskrit sa

Serbian sr

Serbo-Croatian sh

English st

English tn

Shona sn

Sindhi sd

Sinhalese si

Siswati ss

Slovak sk

Slovenian sl

Somali so

Spanish is

Sundanese so

Swahili (Kiswahili) sw

Swedish sv

Syriac

Tagalog tl

Tajik tg

Tamazight

Tamil ta

Tatar tt

Telugu te

Thai th

Tibetan bo

Tigrinya te

Tonga to

Tsonga ts

Turkish tr

Turkmen tk

Twi tw

Uighur ug

Ukrainian uk

Urdu ur

Uzbek uz

Venda

Vietnamese vi

Volapuk vo

Welsh cy

Wolof wo

Xhosa xh

Yi

Yiddish yi, ji

Yoruba yo

Zulu zu

In spellcheck your dictionary is based Other configuration settings:


#######################################中Page(s)############################textarea ############spellcheck free HTML5 free download###

十二、style 属性规定元素的行内样式(inline style)HTML4和HTML5无差异
十三、tabindex 属性规定当使用 "tab" 键进行导航时元素的顺序。

<!DOCTYPE HTML>  
<html>  
<body>  
  
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />  
<a href="http://www.google.com/" tabindex="1">Google</a><br />  
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>  
  
</body>  
</html>
Copy after login

十四、title 属性规定关于元素的额外信息

<!DOCTYPE HTML>  
<html>  
<body>  
  
<p><abbr title="世界卫生组织">WHO</abbr> 成立于 1948。</p>  
<p title="免费的 Web 教程">W3School.com.cn</pl>  
  
</body>  
</html>
Copy after login

Xiaoqiangs road to HTML5 mobile development (13) - Global attributes in HTML5

以上就是 小强的HTML5移动开发之路(13)——HTML5中的全局属性的内容,更多相关内容请关注PHP中文网(www.php.cn)!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!