HTML 
For Juniors PART :4
HTML Attributes
- HTML elements can have attributes
- Attributes provide additional information about an element
- Attributes are always specified
     in the start tag
- Attributes come in name/value
     pairs like: name="value"
The language Attribute
·        
The
document language can be declared in the <html> tag.
·        
The
language is declared in the language attribute.
·        
Declaring
a language is important for accessibility applications (screen readers) and
search engines:
Example:
<!DOCTYPE html>
<html lang="en-US">
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
<html lang="en-US">
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
·        
First two letters
specify the language (en). If there is a dialect, use two more letters (US).
The title Attribute
·        
HTML
paragraphs are defined with the <p> tag.
Example :
<p title="c-sharpcorner">
c-sharpcorner is a website in which the articles, blogs… etc are written on “TECHNOLOGY ”.
c-sharpcorner is a website in which the articles, blogs… etc are written on “TECHNOLOGY ”.
</p>
The href Attribute
HTML
links are defined with the <a> tag. The link address is
specified in the href attribute:
Example  :
<a href="http://www.c-sharpcorner.com">This is
a link</a>.
Size Attributes
·        
HTML
images are defined with the <img> tag.
·        
The
filename of the source (src), and the size of the image (width and height)
are all provided as attributes:
·        
 
Example
:
<img src=" E:\Walls\HTML\c#corner.jpg" width="104" height="142”
The alt Attribute
·        
The alt attribute
specifies an alternative text to be used, when an HTML element cannot be
displayed.
·        
The
value of the attribute can be read by "screen readers". This way,
someone "listening" to the webpage, i.e. a blind person, can
"hear" the element.
Example :
<img src=" E:\Walls\HTML\c#corner.jpg"alt="www.c-sharp corner.com"  width="104" height="142” >
Always Use Lowercase Attributes
·        
The
HTML5 standard does not require lower case attribute names.
·        
The
title attribute can be written with upper or lower case like Title and/or TITLE.
·        
Lower case is the most
common.
·        
Lower case is easier to
type.
 Summary
- All
     HTML elements can have attributes.
- The
     HTML title attribute provides additional
     "tool-tip" information.
- The
     HTML href attribute provides address information for
     links.
- The
     HTML width and height attributes provide
     size information for images.
- The
     HTML alt attribute provides text for screen readers.
- Always
     use lowercase HTML attribute names.


 
 
 
No comments:
Post a Comment