HTML attibutes-

 Attribute are the values to HTML elements which are generally specified in the start tag.

It has some values to be assigned in the form of “attribute= value”

The commonly used attributes are given below.

<html> tag lang attribute

Lang is the attribute which sets the displaying language of the webpage. It has variety of language support.

Generally, we prefer English. It can be represented by “en”. If the US English is your  option,set the lang option as “en-US”.

Examples are given below

<html lang=”en”>

When you want the united states English, use this <html lang=”en-US”>.

When you want to set native languages like tamil,telugu,hindi

Use

 Lang=”ta”  ( for tamil)

Lang =”te” (for telugu)

Lang=”hi”  (for hindi)

 

<img> tag attributes

  <img> tag is used to include image in the webpage.

For that, use “src” attribute to get the URL of image.

For setting height and width, the syntax is as follows

 width=”measurement in pixels”

 height=” measurement in pixels”

when the URL of the image is not available, set the “alt” attribute which gives the message when the image is not displayed.

For eg,

<img src=”image1.jpg”> where “image1.jpg” is the URL of the image file

URL is the Uniform Resource Locator which may be absolute or relative.

Absolute URL is the exact URL( d:\examples\image1.jpg”

Relative URL is the link(image1.jpg). The image is in the same domain.

When you want the image in particular dimension,just set the width and height.

<img src=”image1.jpg” width=”500” height=” 400”>

Next, setting the alternate text when the image is not available,,,

<img src=”image1.jpg” alt=”The image is coming soon”>

Note: alt provides some response text.

<a> tag attribute href

<a> tag  is anchor tag to define hyperlink.” href” assigns the hyperlink to the <a> tag.

Let the syntax be,

<a href=” https:\\www.yoursitename.com”> my company </a>

Sometimes, we include links also…

<p> tag title attribute

When you want to set the title for any paragraph ,title attribute is used.

<p title=”sample”>This is the first line of the paragraph</p>

These are the most commonly used attibutes with HTML elements.

Note:

Always use double quotes for attribute values.

Its easy to use lowercase letters for attibutes.

 

 

 

 

No comments:

Post a Comment