HTML ARRTRIBUTES
- HTML attributes are used to add more information to HTML element
IMPORTANT THINGS TO REMEMBER
- HTML attributes are found in HTML tags.
- HTML attributes only appear at start tags. It will never to be on end tags.
- HTML elements can have multiple attributes.
- HTML attributes are composed of name/value pairs.
- There are some attributes that can be used on all HTML elements through they may not have effects on some elements. They are called global attributes.
- an attribute name
- an equal = sign
- a value surrounded by quotation marks "value"
you can also use single quotation marks depending upon the situation esp. when the value contains double quotes.
We will only use double quotes marks throughout the entire tutorial.
In this lesson we are going to learn some HTML attributes with example:
ATTRIBUTE LANG
<DOCTYPE html>
<html lang = "en - us ">
</html>
we use the lang attribute to define the languages of an HTML files'
The languages defined above is American English.
ATTRIBUTE HREF
<a href= "http:www.example.com"> Go to http://www.example.com</a>
- links are defined using the anchor <a> element.
- On the example above we used the href attribute to tell the browser where to go.
- when clicked the user will be redirected to http://www.example.com
ATTRIBUTE STYLE
<!DOCTYPE html>
<html>
<head>
<title> try it yourself </title>
</head>
<body>
<p style="font-size : 40px; color: gold">
I am a paragraph with a size of 40 pixels and my color is gold.
</p>
</body>
</html>
OUTPUT
I am a paragraph with a size of 40 pixels and my color is gold.
NOTE: TRY THIS IN NOTEPAD OR IN ONLINE HTML COMPLIER
- On the example given above we have created a paragraph using the <p> element.
- We also used the style attribute to change the font-size and color
NEXT : HTML COMMENTS AND STYLE SHEET #clickhere
Spr brother
ReplyDeletePost a Comment