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

SSC WORD

1. TRANQUILITY : ŕ¤¶ांति Meaning:  a peaceful, calm state, without noise, violence, worry, etc. Synonyms:  calmness, coolness Antonyms:  chaos, loudness Example:  Not surprisingly, the desire for tranquility among local inhabitants is almost palpable. 2. REBOUND : वापस आना Meaning:  If an action rebounds on you, it does not have the effect you hoped for but has an unpleasant effect on you instead Synonyms:  recoil, recuperate Antonyms:  weaken, hurt Example:  His continual demands for sympathy rebounded on him because his friends finally stopped listening. 3. INVIGORATE : ŕ¤Ş्रोत्साहन Meaning:  to give new energy or strength to someone or something Synonyms:  boost, stimulate Antonyms:  discourage, dissuade Example:  They argued that a cut in the tax rate would invigorate the ec...
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- srportalgiri_main_AdSense1_250x250_as --> <ins class="adsbygoogle"      style="display:inline-block;width:250px;height:250px"      data-ad-client="ca-pub-2060990885270177"      data-ad-slot="4129699440"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>

Linear Regression- Details

  Linear Regression: Linear regression is a statistical regression method which is used for predictive analysis. It is one of the very simple and easy algorithms which works on regression and shows the relationship between the continuous variables. It is used for solving the regression problem in machine learning. Linear regression shows the linear relationship between the independent variable (X-axis) and the dependent variable (Y-axis), hence called linear regression. If there is only one input variable (x), then such linear regression is called  simple linear regression . And if there is more than one input variable, then such linear regression is called  multiple linear regression . The relationship between variables in the linear regression model can be explained using the below image. Here we are predicting the salary of an employee on the basis of  the year of experience . Below is the mathematical equation for Linear regression: Y= aX+b   Here,...

The DNA Technology (Regulation) Bill

Recently, the DNA Technology (Regulation) Bill was introduced in the Lok Sabha to regulate the use of DNA technology for establishing the identity of a person. What are the provisions of the bill? 1. Establishment of National and Regional DNA Data Bank. 2. Every data bank would have indices such as the crime scene index, suspects’ or undertrials’ index, offenders’ index, missing persons’ index and unknown deceased persons’ index. 3. Establishment of DNA Regulatory Board which accredits labs analysing DNA samples. 4. Written consent by individuals is mandatory before collection of their DNA samples and creating a DNA profile of an individual. 5. However, consent is not required for offences with punishment for more than seven years in jail or death. Deletion of DNA profile from Data banks: 1. DNA profiles of the suspect may be removed on the filing of a police report or court order. 2. DNA profiles of undertrials may be removed based on a court orde...

đź”°VOCABULARYđź”°

1. OBFUSCATE (VERB): (उलझाना): confuse  Synonyms: baffle, bewilder  Antonyms: clarify, explicate  Sentence:- The new rule is more likely to obfuscate people than enlighten them.  2. BRINK (NOUN): (कगार): fringe  Synonyms: periphery, threshold  Antonyms: center, middle  Sentence:- This woman could bring me to the brink of insanity.  3. INTERMITTENT (ADJECTIVE): (सविराम): irregular  Synonyms: fitful, infrequent  Antonyms: regular, frequent  Sentence:- The holiday lights are intermittent and flicker on and off constantly.  4. HERALD (NOUN): (अग्रदूत): messenger  Synonyms: adviser, bearer  Antonyms: pupil, student  Sentence:- A herald sent forward to announce the coming of a king.  5. INSULAR (ADJECTIVE): (संकुचित ...

Follow the Page for Daily Updates!