In last class, you got some idea about tags. Today we will discuss attributes of the tags.
Quiz class 2:
What do you mean by tag.
What are the uses meta tags.
Define base tag with examples..
CLICK HERE: FOR HTML CLASS 2
LEARN FROM IIT PASS OUTS AND INDUSTRY EXPERTS
HTML Class 3
Understanding attributes
Quiz class 2:
What do you mean by tag.
What are the uses meta tags.
Define base tag with examples..
CLICK HERE: FOR HTML CLASS 2
LEARN FROM IIT PASS OUTS AND INDUSTRY EXPERTS
HTML Class 3
Understanding attributes
Attributes of the tags are an important segment of HTML which are used to define different characteristic of various tags. Every attribute has two parts, name of attribute and value associated with that attribute.
Example: <font face="arial" color="#F1FF00">
Tag: <font...>
Name: face, color
Value: arial for face and it could be replaced by diffrent values of face like italic, calibri etc.
#F1FF00 for color and it could be replaced by diffrent values of color like #FFFF10, #000FFF etc.
As shown in example, name and value is always placed inside the opening tag. Value is always placed within double quote mark"".
Equal sign is used to assign an specific value to the name.
Core Attributes:
ID
Title:
Style:
Class:
Let's discuss it
ID Attribute:
It gives unique identity to the tag, which makes identification of that tag easy within an HTML document.
Format: <p id="h123">...</p>
ID attribute must start with capital or small letter and may followed by capital or small letters, numbers, colons, underscore, hyphen,and periods.
Title Attribute:
The title attribute defines title for the tag and used as tool tip.
Example:
<h4 title="Hello world">Loading...</h4>
Above code will generate following result:
Loading...
when you will put cursor on it, the title would come on screen.
Class Attribute:
The class attribute is used to specify class of a tag within cascading style sheet(CSS). In css class, you will learn more about it.
Style Attribute:
The style attribute is used to define cascading style sheet rule for the tag
Example:
<p style="font-family:arial; color:#FF0000;">Hello World</p>
Internationalization Attributes:
These attributes are used to define characteristics of html tag which is the main tag of an HTML document as entire document is contained within it.
dir: instructs the browsers about the direction for the flow of text.
It takes two values only.
ltr: left to right
rtl: right to left
Example:
<html dir=rtl>
<head>
<title>Give Direction for floating</title>
</head>
<body>
This is how IE 5 renders right-to-left directed text.
</body>
</html>
*Try changing dir values.
lang: provides information about the main language used within the html document.It takes ISO-639 standard two character language codes as value.
Example:
<html lang=en>
<head>
<title>English Language WebPage</title>
</head>
<body>
This page is using English Language
</body>
</html>
* for both of these tags,
when used within html tag, instruction given by these attributes are applicable to the entire document
when used within other tag, instruction given by these attributes are applicable to the content of that tag only.
No comments:
Post a Comment