CREATING FIRST WEBPAGE
Step 1 Open up a text editor (SimpleText for Mac or Notepad for Windows)
Step 2 Enter the following:
<html>
<head>
<title> This is my first web page</title>
</head>
<body>
Hello world. This is my first web page. There’s more to come.
</body>
</html>
Step 3 Save the document as: firstpage.html
Your file can be saved as either an htm or html file. Remember to save your document on the computer in a place that you can find it again.
Step 4 To preview your new document, open the file firstpage.html on Internet Explorer or any browser.
HTML ELEMENTS (TAGS) in DETAIL
Body Element and <BODY> TAG
The <body> element appears after the <head> element and contains the part of the Web page that you actually see in the main browser window, which is sometimes referred to as body content.
Attributes of <Body> Element
bgcolor: this attribute is used to give background color to webpage. It can take value as color name or color code (hex-code for color) with Bfcolor attribute we can give single color background only
syntax
<body bgcolor=”GREEN”> will make GREEN color background of the webpage OR <body bgcolor=”#bee3c2“>…</body>
- The bracket and tag appear first (<body).
- Always add a space between the tag and attribute.
- Then enter the attribute (bgcolor).
- Equal sign goes next (=).
- Next are quotation marks that contain a description of how the attribute should look like (“#bee3c2”). In this case, it’s a code for the color green.
- Close with a bracket (>).
- Then, add your closing tag </body>.
Text : text attribute is used to give the default font color for webpage It can take value as color name or color code
syntax
<body text=”BLACK”> will make text color black for the webpage
OR <body text= “#000000″>…</body>
We can combine different attribute of same element in opening tag
RULE
<Element Attribute1=”value” Attribute2=”value” …AttributeN=’value”>
<body bgcolor=”RED” TEXT=”BLACK”> this will make green color background and default text color as Black
To give a picture background we have another body attribute that is
BACKGROUND : background attribute is used to give picture as background to webpage
Syntax
<body background=”c:/images/1.jpg” > this will make 1.jpg file as background, if the file size is small it will make titled the image to fill entire background
NOTE : if the picture is in same folder of your webpage you can simply write the name of picture file in the value for example 2.jpg is in the same folder of webpage then the syntax will be
<body background=”2.jpg” text=white>
If the picture is in other folder of your webpage you can simply write the folder/name of picture file in the value for example 2.jpg is in the same folder of webpage then the syntax will be
<<body background=”c:\images\2.jpg” > |
Other attribute are for hyperlinks present in webpage they are link, alink & vlink all three take color name or color code as value
<body bgcolor=”green” link=”red” vlink=”blue” alink=” white” >
Link attribute is used to give different color to Hyperlink text link=”red” means all links will be in red color before clicking
Alink attribute is used to give color when hyperlink is Clicked vlink=”white” means all hyperlink while clicking will become white
Vlink attribute is used to give color to visited link means color of hyperlink changes once the hyperlink is visited. vlink=”blue” means all links will be blue in color after visiting the link
We can give all the body element attributes together in opening tag of body element
Syntax
<body bgcolor=”PINK” Background=”2.jpg” link=”red” vlink=”blue” alink=”Green”>
NOTE
Remember you can either get bgcolor or background in output generally background is shown when both attributes are given but if the browser don’t get the picture at required location it will show bgcolor.
Previous |
Solved Examples |
Unsolved Questions for Practice |
Next |