4.HTML Attributes Tutorial for Beginners

First of all it is HTML Attributes Tutorial for Beginners.We have seen few hypertext mark-up language tags and their usage like heading tags <h1>, <h2>, paragraph tag <p> and alternative tags. we have a tendency to used them up to now in their simplest type, however most of the hypertext mark-up language tags may have attributes, that area unit additional bits of knowledge.
An attribute is employed to outline the characteristics of associate hypertext mark-up language part and is placed within the element’s gap tag. All attributes area unit created of 2 parts: a reputation and a value :

* The name is that the property you wish to line. as an example, the paragraph <p> part within the example carries associate attribute whose name is align, that you’ll use to point the alignment of paragraph on the page.
*  The worth is what you wish the worth of the property to be set and forever place inside quotations. The below example shows 3 potential values of align attribute: left, center and right.

Attribute names and attribute values area unit case-insensitive. However, the planet Wide internet association (W3C) recommends little attributes/attribute values in their hypertext mark-up language four recommendation.

<!DOCTYPE html>
<html>
<head>
<title>Align Attribute Example</title>
</head>
<body>
<p align="left">1.This is left aligned</p>
<p align="center">2.This is center aligned</p>
<p align="right">3.This is right aligned</p>
</body>
</html>

This will engender the following result:

HTML Attributes Tutorial for Beginners

Core Attributes

The four core attributes of HTML elements (albeit not all) are:

  • Id
  • Title
  • Class
  • Style

The Id Attribute

The id attribute of associate degree markup language tag is accustomed unambiguously establish associate degreey part among an markup language page. There area unit 2 primary reasons that you just may need to use associate degree id attribute on associate degree element:

  • If part carries associate degree id attribute as a singular symbol, it’s attainable to spot simply that part and its content.
  • If you have got 2 parts of an equivalent name among an online page (or vogue sheet), you’ll use the id attribute to differentiate between parts that have an equivalent name.

Example

<p id="html">This para explains what is HTML</p>
<p id="css">This para explains what is Cascading Style Sheet</p>

The title Attribute

The title attribute offers a advised title for the part. They syntax for the title attribute is comparable as explained for id attribute:

<!DOCTYPE html>

<html>

<head>

<title>The title Attribute Example</title>

</head>

<body>

<h3 title="Hello HTML!">Titled Heading Tag Example</h3>

</body>

</html>

This will engender the following result:

 HTML Attributes Tutorial for Beginners

The class Attribute

class="className1 className2 className3"

The style Attribute

<!DOCTYPE html>

<html>

<head>

<title>The style Attribute</title>

</head>

<body>

<p style="font-family:arial; color:#FF0000;">Some text...</p>

</body>

</html>

This will engender the following result:

HTML Attributes Tutorial for Beginners

Generic Attributes

So Here’s a table of another attributes that are promptly usable with several of the hypertext markup language tags.

HTML Attributes Tutorial for Beginners

(HTML Attributes Tutorial for Beginners)

in conclusion We will see connected examples as we’ll proceed to review alternative markup language tags.In conclusion if you want to learn html perfectly you should follow the given tutorial correctly.So that you can be good in web designing.Finally that is all for HTML Attributes Tutorial for Beginners.Please see our next tutorial  HTML–FORMATTING Tutorial for Beginners.

Comments

comments