HTML Code

 

Free HTML Codes for Websites

HTML uses tags, elements, and attributes in the code. Tags are the mark-up regions that are used in the symbols “< >”. Elements refer to the tag that starts with a start tag < tag > and ends with a close tag < /tag >. The elements that are necessary for each HTML page are HTML, Head, Title, and Body. A webpage can be designed using the four tags. Attributes refer to the features of html elements. Content can be added to a page by directly adding it to the < body > or by adding it to the < table > element. Images can be inserted directly to the body or you can design a table and place the images into the columns and rows of the table. Images or colors can even be added to the background of the page by using various tags. The article will explore some HTML tags like title tags, body tags, and image tags. There would also be links to free HTML codes for websites and tutorials.


Giving Your Page a Title

In a webpage, there can only be one < Title >. To design a web page, first place the HTML tag and then the Head tag. The Title is enclosed between the < Head > element. < Title > is the tag that gives the Name to the webpage and it can be seen at the top of the page along the browser icon. The < Head > tag is the section where you can place the code for the Name, Style, and Place Meta tag which provides information about the webpage to search engines. Tags, such as < base >, < Meta >, < style >, < script >, < link >, and < title > can be placed in the Title element. Here’s a sample code:

< html >

< head >

< title > Title of the document < /title >

< /head >

< body >

< /body >

< /html >


Using the Body Tag

The body is the main section of the webpage where you can design a table, make lists, and add links or images. The body tag is placed below the head tag < /head >. The < bgcolor > tag is used to add color to the background of the webpage and the “background” is used to place an image on the background of the webpage. A number of images can be placed in the background and you can change the size of the image as required. You can make creative designs from the images and place it side by side to depict various design patterns. The sample HTML codes for adding images to the background and adding colors to the background are given below:


To add background color

< html >

< head >

< title >Title of the document< /title >

< /head >

< body bgcolor=”Silver” >

< /body >

< /html >


To add background image

< html >

< head >

< title >Title of the document< /title >

< /head >

< body background=”DSC00517.jpg” >

Page with a background image

< /body >

< /html >


Table

The table is a structure composed of rows and columns. In HTML, the < tr > and < td > tags are used for adding the number of rows and columns. Some other attributes that can be used in table tags are col, thead, tfoot, tbody, caption, and colgroup. Border attribute is used to define the thickness of the table line. To make it invisible, border is given the value “0”. Colors can be added to specific rows or columns of a table or the entire table. You can insert images in one box, column or row of the table. Cellpadding and cellspacing are used for adjusting space in the table. Bgcolor is used to give background color to tables.

A sample code for designing a table is:

< Body >

< table border=”1” >

< tr >< td >Row 1 cell 1< /td > < td >Row 1 Cell 2< /td >< /tr >

< tr >< td >Row 2 Cell 1< /td >< td >Row 2 Cell 2< /td >< /tr >

< tr >< td >Row 3 Cell 1< /td >< td >Row 3 Cell 2< /td > < /tr >

< /table >

< /Body >


Adding Images

Images can be linked to HTML pages through the tag < img src = “abc.gif” >. Here, you link the source of the image to depict it on the web page. Images can have many attributes such as alt, src, height, ismap, usemap, and width. As the images are not created in the page, the image should also be uploaded to the web server to depict it on a website. Images can be added to a website in the form of Gifs or Jpegs. Gifs are considered best for buttons and banners because they have a transparent background. On the other hand, the Jpeg image’s size to quality ratio renders a higher quality to the pictures. Here’s a sample code:

<body>

<img src=”http://website.com/1/sunset.jpg” alt =”sunset”/>

</body>


Inserting Links

A webpage can be referenced to an external source of information or image. The link tag is used to link the webpage to an external source and it can be used in the style sheet of a web page. A page is either referenced to an internal source, local source (such as the link on the domain) or it can be linked to a global source to the domain outside the site. To set a default URL for all the links on the page, the < base > tag in the < head > tag of the web page is used. Mailto and email address can be included in the body to get feedback.

Here’s a sample code to link to a webpage:

< body >

 < a href=”www.example.com > new site < /a >

< /body >

Sample code to link to email feedback –

< body >

< a href=”mailto:email@yahoo.com?subject=Feedback& body=Hi!” > websiteowner@yahoo.com < /a >

< /body >


Additional Resources

For website owners and designers, there are many HTML codes on the Internet. Searching for HTML codes for websites is not difficult at all.