Skip to main content

HTML5 Attributes

As explained in previous chapter, elements may contain attributes that are used to set various properties of an element.
Some attributes are defined globally and can be used on any element, while others are defined for specific elements only. All attributes have a name and a value and look like as shown below in the example.
Following is the example of an HTML5 attributes which illustrates how to mark up a div element with an attribute named class using a value of "example":
<div class="example">...</div>
Attributes may only be specified within start tags and must never be used in end tags.
HTML5 attributes are case insensitive and may be written in all uppercase or mixed case, although the most common convention is to stick with lowercase.

Standard Attributes:

The attributes listed below are supported by almost all the HTML 5 tags.
AttributeOptionsFunction
accesskeyUser DefinedSpecifies a keyboard shortcut to access an element.
alignright, left, centerHorizontally aligns tags
backgroundURLPlaces an background image behind an element
bgcolornumeric, hexidecimal, RGB valuesPlaces a background color behind an element
classUser DefinedClassifies an element for use with Cascading Style Sheets.
contenteditabletrue, falseSpecifies if the user can edit the element's content or not.
contextmenuMenu idSpecifies the context menu for an element.
data-XXXXUser DefinedCustom attributes. Authors of a HTML document can define their own attributes. Must start with "data-".
draggabletrue,false, autoSpecifies whether or not a user is allowed to drag an element.
heightNumeric ValueSpecifies the height of tables, images, or table cells.
hiddenhiddenSpecifies whether element should be visible or not.
idUser DefinedNames an element for use with Cascading Style Sheets.
itemList of elementsUsed to group elements.
itempropList of itemsUsed to group items.
spellchecktrue, falseSpecifies if the element must have it's spelling or grammar checked.
styleCSS Style sheetSpecifies an inline style for an element.
subjectUser define idSpecifies the element's corresponding item.
tabindexTab numberSpecifies the tab order of an element.
titleUser Defined"Pop-up" title for your elements.
valigntop, middle, bottomVertically aligns tags within an HTML element.
widthNumeric ValueSpecifies the width of tables, images, or table cells.
For a complete list of HTML5 Tags and related attributes please check reference to HTML5 Tags.

Custom Attributes:

A new feature being introduced in HTML 5 is the addition of custom data attributes.
A custom data attribute starts with data- and would be named based on your requirement. Following is the simple example:
<div class="example" data-subject="physics" data-level="complex">
...
</div>
The above will be perfectly valid HTML5 with two custom attributes called data-subject and data-level. You would be able to get the values of these attributes using JavaScript APIs or CSS in similar way as you get for standard attributes.

Comments

Popular Post

Current affairs

Narendra Ambwani elected as chairman of the Advertising Standards Council of India (ASC Published on: 13-SEP-2014 Important for Exam:  6 people agreed Narendra Ambwani on 12 September 2014 elected as Chairman of the Advertising Standards Council of India (ASCI). SBI celebrated 150 years of its operations in Sri Lanka Published on: 13-SEP-2014 Important for Exam:  6 people agreed State Bank of India (SBI) on 13 September 2014 celebrated 150 years of its operations in Sri Lanka. West Bengal cabinet cleared farmer-friendly project Sech-Bandhu Prakalpa to boost irrigation Published on: 13-SEP-2014 Important for Exam:  8 people agreed The West Bengal cabinet on 12 September 2014 cleared a farmer-friendly project named  Sech-Bandhu Prakalpa  to boost irrigation. Delhi Government to charge cess of one rupee on cigarette and liquor to promote public tra Published on: 13-SEP-2014 Important for Exam:  5 people agreed ...

📍 DIFFERENCE BETWEEN FDI and FPI

  DIFFERENCE BETWEEN FDI and FPI #Stockmarket 💡 FDI is involved in setting up firms to produce goods and services. That is why it is called 'direct' institution. FPI on the other hand buys financial assets for profits. In order to remove the ambiguity that prevails on what is Foreign Direct Investment (FDI) and what is Foreign Institutional Investment (FII), it was decided to follow the international practice and lay down a broad principle that, where an investor has a stake of 10 percent or less in a company, it will be treated as FII and, where an investor has a stake of more than 10 percent, it will be treated as FDI. 💡 Since the source of funds is not revealed, the PNs are potentially unsafe. Therefore, SEBI imposed certain conditions like limits on the PNs that a single FII can issue, etc. SEBI wants the PN holders to register with SEBI and invest directly as India is a long-term growth story. SEBI policy paid off with the number of FIIs registering with the regulator go...

Indian bank clerk interview questions .

Indian bank clerk interview questions – www.indianbank.in  : Indian bank is a premiar public sector bank in india. indian bank has creating oppertunities for unemployed,as a probationary officers , clerks,specialist officers,advisors, consultants, security officers, law officers,generalist cadre officers,in continuation with that bank issues every year recruitment notifications mainly to recruit POs and clerks with large no of vacancies. Here is given Indian bank clerk interview questions to the bank job aspirants for giving idea on interview questions. It may helpful who prepares for Pos, clerks and other officer cadre jobs. Indian bank clerk interview questions: 1)Where was the Head Quarters of Indian Bank located ? A)Chennai,Tamilnadu 2)Who is the Chairman of Indian Bank ? A)Shri T.M. Bhasin 3) When did the bank came into existence ? A)Established on 15th August 1907 as part of the Swadeshi movement 4) What was the indian bank initial name? A) 5) When was nati...

■ Can India Become A Technology Leader? India

  ■ Can India Become A Technology Leader?   ✅India is presently not a major player in the field of technology due to certain challenges and on the other side, there are many celebrated Indian technologists around the world as many of the technology giants choose an India- born techie as their leader. ✅The conversation around Indian executives at the helm of top tech companies has gathered some momentum with Parag Agrawal taking over as Twitter CEO. The major technology companies like Google and its parent company Alphabet, Microsoft and Twitter, Adobe and IBM are all headed by Indians. ● The Case of the U.S: ✅The Indian immigrants in the U.S are the part of the most educated and professionally accomplished communities in that country. ✅As of 2019, there were 2.7 million Indian immigrants in the U.S. ✅The government of the U.S has been instrumental in the triumphs of enterprise and the free market. ✅The governmental agencies have been actively supporting the research and develo...

World famous event

1. Walmart to open new store in India after 2-year gap  i. After a gap of two years, US retail major Walmart will open a new cash and carry store in Agra as it returns focus on India.  ii. The company, which opened its last store in Bhopal towards the end of 2012, has said it will focus on cash and carry business in India in the absence of clarity on FDI in multi-brand retail trade. iii. "Walmart is committed to India and we are focused on our growth plans... We have recently received all internal approvals for opening a new store in Agra, our second one in the city," Walmart spokesperson told PTI. 2. Jyotsna Suri elected as the President of the FICCI i. Jyotsna Suri, Chairperson of Bharat Hotels, on 20 December 2014 was elected as the President of the Federation of Indian Chambers of Commerce & Industry (FICCI). ii. Suri succeeded Sidharth Birla. iii. Alok B Shriram, deputy managing director of DCM Shriram Industries Ltd, assumed the charge of the presid...

Follow the Page for Daily Updates!