HTML Attributes
We have seen few HTML tags and their
usage like heading tags <h1>, <h2>, paragraph tag <p>
and other tags. We used them so far in their simplest form, but most of the
HTML tags can also have attributes, which are extra bits of information.
An attribute is used to define the
characteristics of an HTML element and is placed inside the element's opening
tag. All attributes are made up of two parts: a name and a value:
·
The name is
the property you want to set. For example, the paragraph <p> element
in the example carries an attribute whose name is align, which you can
use to indicate the alignment of paragraph on the page.
·
The value is
what you want the value of the property to be set and always put within
quotations. The below example shows three possible values of align attribute: left,
center and right.
For Example :
<DOCTYPE
html>
<html>
<head>
<h1>Hello JKS DIGI </h1><br
/>// break line
<title>This Align Attribute
example </title>
</head>
<body>
<p
align="left">This is left aligned</p>
<p
align="center">This is center aligned</p>
<p align="right">This is right
aligned</p>
</body>
</html>
You can try it yourself from here given link :
Just copy above code and past it in the code section and click on
the JKS RUN>> button to find
the result.
This
will display the following result :Core Attribute:
There are four (4) core attributes that can be used on the
majority of the HTML Elements are :
1.
ID Attribute
2.
Title Attribute
3.
Class Attribute
4.
Style Attribute
The ID Attribute :
The ID Attribute <div id=”html”>Contents goes
here</div> <div id=”css”>Contents goes here</div> used
uniquely to identify within an HTML Elements or Tags.
ID Attribute should
be use uniquely in an HTML Elements or Tags to identify. If you have more elements,
contents, div etc. to use more ID Attributes to identify.
For Example :
<DOCTYPE html>
<html>
<head>
<h1>Hello JKS DIGI </h1><br
/>// break line
<title>This is ID Attribute example </title>
</head>
<body>
<p id="text1">This
is first id attribute</p>
<!--
id attributes should be unique for each declaration
-->
<p id="text2">This
is second id attribute</p>
<p id="text3">This is third id
attribute</p>
</body>
</html>
You can try it yourself from here given link :
Just copy above code and past it in the code section and click on
the JKS RUN>> button to find the result.
Thanks for sharing the information about PHP, MOURI Tech LLC Provides all Technical solutions from ERP, CRM, DevOps, Robotic Process Automation to all EMERGING TECHNOLOGIES for more information you can check our website www.mouritech.com
ReplyDeletePost a Comment
Give suggestions if any? Thanks! Jitendra Kumar