Sunday 15 December 2013

Tutorial on HTML

Using CSS:

With just HTML, inserting images and other things might be difficult and it can  be done only with coding.So to overcome this situation you may use CSS.You cantype it in notepad and save the file with the extension .css

What is CSS?

  • CSS is nothing but cascading style sheet.
  • A stylesheet can be created by using STYLE tag (i.e) <style>
  • In  CSS we can have three type of selectors,which are :
  1. Class selector
  2. HTML selector
  3.  ID selector
HTML selector:

  • HTML selector can be created by removing the angular brackets (i..e) H1 instead of <H1>
Class selector:
  • A selector that can be defined by the user is called class selector.(i.e) The user has the choice to use the name of his choice.A class selector should start with .
ID selector:
  •  Using ID selector,the user can identify a particular name on a form and it is similar to class selector.ID selector should start with # (hash)

Example:

<style>
H1{color:blue}
.fontsize{Font-size:16}
#fonttype{Font-type:bold} 
</style>

Inserting Images:

Generally, there are two types of images GIF and JPEG. These two types of images can be inserted in CSS or html 


Sample code:

<img src="abc.gif">

The image tag doesn't has an end tag.So that you need not end the tag using </image> or something else.

Sample webpage code with image inserted:

<html> 
<head><center>Sample web page</center> 
<title>Testing web page</title> 
</head> 
<body> 
<font color="blue"><center><b>This is my first 
web page and i'm going to insert some image 
and change the background colour of my web 
page</center></b></font>
 
<body bgcolor="green"> 
<center><img src="abc.jpg"></center> 
 </body> 
 </html>

Sample output:


No comments:

Post a Comment