HTML

HTML Projects

HTML Project

Attributes In HTML
Previous Home Next
adplus-dvertising

An attribute is providing additional information for associated property about HTML elements and Html attribute can be written within a specified in start tag. Html attributes are written with of two parts: a name and a value

Attributes come in name/value pairs like: name="value"

Note: Html attribute names are case-insensitive and attribute values are not case-insensitive.

This name and value is shown like as :

Example

<!DOCTYPE html>
<html>
<head>
<title>Align Attribute  Example</title>
</head>
<body>
<p align="left">welcome users in left aligned </p>
<p align="center">welcome users in  center aligned</p>
<p align="right">This is right aligned</p>
</body>
</html>

Output :

HTML Attributes are shown as below :

NameDescription
altIt is used as an alternative text for an image
hrefIt is used as the URL (web address) for a link
idSIt is used as a unique id for an element
srcIt is used as the URL (web address) for an image
styleIt is used as an inline CSS style for an element
titleIt is used as extra information about an element (displayed as a tool tip)
valueIt is used as the value (text content) for an input element.

Example of the href Attribute

HTML href Attribute used a links with the <a> tag .

 <a href="http://www.r4r.co.in">Welcome user's in a link</a> 

Output :

Example of Size Attributes

Html images are used within <img> tag as follows :

<!DOCTYPE html>
<html>
<body>
<p>Click following link</p>
<a href="http://www.r4r.co.in" target="_self"> 
   <img border="0" src="file:///C:/xampp/htdocs/images/logo.gif" 
width="72" height="72"></p>
</body>
</html>

Output :

when we click on this image and used a image attribute <img> with a link of own requried website then we have go to website.

Example of HTML paragraphs are defined with the <p> tag.

In the HTML paragraphs are defined with the <p> tag.

<!DOCTYPE html>
<html>
<body>
<h1>About www.r4r.co.in</h1>
<p title="About r4r.co.in">
r4r.co.in is a web developer's site.
It provides tutorials and references covering
many aspects of web programming,
including HTML, CSS, JavaScript, XML, SQL, PHP, ASP, etc.
</p>
</body>
</html>

Output :

Previous Home Next