ArticlesBase.com - Free Articles Directory
Free Online Articles Directory
07.10.2008 Sign In Register Hello Guest
Email:
Password:
Remember Me 
forgot your password?


Creating Your Own Web Page Is Easy - A Tutorial (Part 2)

Author: Efren A. Author Ranking Blue | Posted: 17-05-2007 | Comments: 0 | Views: 8 | Rating:  (50) Article Popularity - Green (?) Got a Question? Ask.
Sign Up Now!

Now, Let's continue with Part 2. We will discuss the following here: Creating tables and Using CSS boxes as webpage layout.

Here's how:

Creating tables

Tables are very useful in the presentation of data. The following are the html tags to be used to create a basic table:

Single-column table:

‹table width="400" border="1" cellspacing="2" cellpadding="4">
‹tr›‹td›row 1 data‹/td›‹/tr›
‹tr›‹td›row 2 data‹/td›‹/tr›
‹/table›

Type the above in your mywebpage.html within the body tags, save and refresh your browser. That's the table on the web. Referring to the above html codes, width refers to the width of the whole table (you may also use pixel here like "800"), border is the outside line or outline of the table, cellspacing is the space between the cells, cells are the area where the data are located, cellpadding is the space between border and cells. You may change the values of these table attributes or properties based on your preference or requirement.

Though the above table html codes are still working, http://W3C.org requires the table properties or attributes be defined in the style sheets or CSS. Using CSS, the above table properties could be presented as follows:

Within style tags in the head:

.type1 {
width: 400px;
padding: 4px;
margin: 2px;
}

.border {
border: 1px solid #000;
}

Then, within the body tags:

‹table class="type1 border"›
‹tr›‹td›row 1 data‹/td›‹/tr›
‹tr›‹td›row 2 data‹/td›‹/tr›
‹/table›

Looking at the codes, "type1" is preceded by dot (.), meaning it is a class selector. For the next type of table properties or attributes, you may label it as type2, then type3 and so on or with other names you prefer. "border" is also a class selector and "border: 1px solid #000" is the thickness (1px), border type (solid) and color (#00f) of the border. There are more discussions of CSS in "Creating CSS boxes as web page layout" and in "Using CSS in styling your web pages"

If you want to try the above, then type the codes within the style and body tags as noted, save it and refresh your browser. It must be the same as the first one.

Now, let's make a 2-column or multi-column table:

‹table width="400" border="1" cellspacing="2" cellpadding="4"›
‹tr›‹td›row 1 data 1‹/td›
‹td›row 1 data 2‹/td›‹/tr›
‹tr›‹td›row 2 data 1‹/td›
‹td›row 2 data 2‹/td›‹/tr›
‹/table›

Type the above in your mywebpage.html within the body tags, save and refresh your browser. That's the 2-column table on the web. To add a column, just insert ‹td›‹/td› after ‹/td›. 1 ‹td›‹/td› is one column, 1 ‹tr›‹/tr› is one row and 1 ‹table›‹/table› is one table.

Now, lets make a table with 1 main heading and 3 subheadings:

‹table width="400" border="1" cellspacing="2" cellpadding="4"›
‹tr›‹td colspan="3"›Main Heading‹/td›‹/tr›
‹tr›‹td›Subheading 1‹/td›
‹td›Subheading 2‹/td›
‹td›Subheading 3‹/td›‹/tr›
‹tr›‹td›row 1 data 1‹/td›
‹td›row 1 data 2‹/td›
‹td›row 1 data 3‹/td›‹/tr›
‹tr›‹td›row 2 data 1‹/td›
‹td›row 2 data 2‹/td›
‹td›row 2 data 3‹/td›‹/tr›
‹/table›

Type the above in your mywebpage.html within the body tags, save and refresh your browser. See? Yes, just use colspan to merge the columns. To merge 2 columns, use colspan="2" and for 3 columns, use colspan="3" and so on.

If you want to merge rows, use rowspan instead of colspan. See this example:

‹table width="400" border="1" cellspacing="2" cellpadding="4"›
‹tr›‹td rowspan="2"›merge row data‹/td›
‹td›row 1 data 2‹/td›‹/tr›
‹tr›‹td›row 2 data 2‹/td›‹/tr›
‹/table›

Now, type the above in your mywebpage.html within the body tags, save and refresh your browser. Now, you see that 2 rows in your first column were merged.

Try creating your own table using different values to familiarize yourself in manipulating tables.

Creating CSS boxes for web page layout

Before, tables are being used as layout of a web page. So, the header, right bars, left bars, main content areas and footer are inside of a table. This slows down the loading of the page as the browser will have to complete first the table before it will display the content. Your visitor may have already left before your page could be displayed. If you prefer to use table as your layout, you have to avoid using big tables. You better use small tables to allow the browser display your page little by little but faster.

Though table could still be used, W3C requires CSS boxes to be used for layout instead of tables due to the issue of accessibility. CSS boxes load faster than tables. These could be controlled within the style sheets that could be within the head tags or in separate CSS file. The most critical part in css boxes is the positioning. So, I'll explain to you the positioning properties of these boxes, based on my experience:

position: absolute - You have to define the x-axis and y-axis as point of reference of the corner of the box. x-axis is either left or right and y-axis is either top or bottom. You have to define also the width or the left and right margin or padding of the box. The box is not affected by the preceding or subsequent boxes. Likewise, the boxes preceding or following the boxes that are positioned as absolute are also not affected.

float: left or right - You need to fix the width. You also need to select if left or right. The box will lean on the side you selected. It will lean on the box preceding it if there is enough space for it. This is affected by the other boxes except for the absolutely positioned boxes.

no position or position: static or fixed - This follows the normal flow. This is also affected by the other boxes except for the absolutely positioned ones. You need to define the width or the left and right margin.

Now, see the illustration below that will create 5 boxes, namely: headerbox, leftbox, centerbox, rightbox and footerbox. These are liquid boxes, which automatically adjust in width when the display window size of the computer is changed:

‹style type="text/css"›
body {
text-align: center;
margin: 1px;
}
#headerbox {
width: 100%;
height: 15%;
background-color: #9cf;
border: 1px solid #00f;
padding: 0px 0px 0px 0px;
margin: 0px 0px 0px 0px;
}

#rightbox {
float: right;
width: 20%;
margin-top: 5px;
text-align: center;
background-color: #cff;
border: 1px solid #00f;
height: 100%;
}
#leftbox {
float: left;
margin-top: 5px;
width: 20%;
text-align: center;
background-color: #cff;
border: 1px solid #00f;
height: 100%;
}

#centerbox {
width: 99%;
margin-top: 5px;
text-align: center;
background-color: #cff;
border: 1px solid #00f;
height: 100%;
}

#footerbox {
width: 100%;
text-align: center;
height: 15%;
vertical-align: middle;
margin-top: 5px;
background-color: #9cf;
border: 1px solid #00f;
}

‹/style›
‹/head›
‹body›

‹div id="headerbox"›HEADERBOX content area‹/div›

‹div id="leftbox"›LEFTBOX content area‹/div›

‹div id="rightbox"›RIGHTBOX content area‹/div›

‹div id="centerbox"›CENTERBOX content area‹/div›

‹div id="footerbox"›FOOTERBOX content area‹/div›

‹/body›

First, you type the above html codes to you mywebpage.html within the head, style and body tags as noted in the above. Then, save it and refresh your browser or open the file with your browser. Are you seeing the headerbox on the top, the leftbox, rightbox and centerbox in the middle and footerbox at the bottom? Try to change the width of your browser window. See? The width of the boxes are also adjusting and that is excellent as your page will auto-adjust depending on the browser window size of your visitors! That is because I used %s in defining the width of boxes.

Now, let me explain the above codes for creating boxes as your layout.

headerbox - preceded with #, meaning it is an id selector and could be used only once per page; float: left means the box will lean on the left if fit; width: 100% means the box is 100% of the browser window and that is the reason why it is liquid; height: 15% means the box is 15% of the browser window; text-align: center is the alignment of the objects or characters inside the box; background-color: #9cf is the color of the space within the box; border: 1px solid #00f is same as discussed in Creating Tables.

rightbox - same explanations in the above except for the float: right which means the box will lean on the right and margin-top: 5px is the distance from the bottom line of the box above (headerbox).

leftbox - same explanations in the above.

centerbox - same explanations in the above except that it has no position defined, meaning it will follow the normal. It will fit itself based on the available space. This will be its 100% or full size. More than this limit will distort the box alignment.

footerbox - same explanations in the above except for the vertical-align: middle, which means that the objects or characters inside the box will be vertically-aligned in the middle.

Try changing the values of the values of the css boxes above, then save. Refresh your browser and familiarize yourself with the effect of each change. Please note, however that there may be minor differences if the above css boxes are displayed with browsers other than internet explorer like firefox and opera.

Continue with Part 3.

Rate this Article: Current: 0 / 5 stars - 0 vote(s).

Article Source: http://www.articlesbase.com/internet-articles/creating-your-own-web-page-is-easy-a-tutorial-part-2-148942.html

Print this Article Print article   Email to a Friend Send to friend   Publish this Article on your Website Publish this Article   Send Author Feedback Author feedback  
About the Author:
Efren A. can help you Make Money Online, Work At Home and Home Schooling with free seo tools, free ad posting, money making ebooks and many free stuff.
Submitting articles has become one of the most popular means of generating quality backlinks and targeted traffic to your website. Join us today - It's Free!

Article Comments

Comment on this article Comment on this article
Your Name
Your Email:
Comment Body
Enter Validation Code: Captcha


Got a Question? Ask.

Ask the community a question about this article:

Frequently Asked Questions

Image enlargement
By: tsmi29 | 06-07-2008
I built a website and I am wondering how to make the images enlarge when a person who visits the website clicks on an image?

Beginner Website Creator
By: janet | 20-05-2008
What is the easiest and best site for a do-it-yourself website for a beginner? 

Meta tags how can I change them?
By: sparky1 | 02-04-2008
I have a website that is not doing well. I was told that my tags were really bad and asked the people who built the site to change them but to no avail. I have access to my control panel but I have no idea what I have to go into to change them can anyone help me with this?

Police scanner radio
By: odoul | 30-03-2008
How can I add police scanner radio to my website?

How do you remove padding from a hardwood floor ...
By: cordingtree | 02-09-2007
how do you remove padding from a hardwood floor without damaging the floor

How do I create fast-moving movies from photos, as in this example?
By: Ecrivaine32 | 26-08-2007
How do I create movies in this style (see YouTube link), from photos moving very quickly? I've often wondered how people do this. I have a Mac with iWeb. Might I already have the tools at my disposal? Click this link

Q&A Powered by:
Powered by Yedda 

Latest Internet Articles

SEO Hints on How to Optimize a Website - Advanced SEO Tips
By: Peter Nisbet | 07/10/2008
These elementary and advanced SEO hints and tips can show you how to optimize a web page properly in order to achieve the highest possible search engine listing. Some people search for the more advanced techniques before they apply all of the basic methods that can get them a quick initial listing; you should always remember to get the basics right first before you try the difficult stuff.

How to Sell Electronic Components Online
By: Daniel Millions | 07/10/2008
Electronics manufacturers typically have websites, just like every other business these days, because a web presence is an important way for businesses to interact with customers all over the globe rather than just on a local level. The websites generally offer information about the latest models and versions of whatever...

Just Because You Don't Want to Hear It, Doesn't Mean it Isn't True
By: Jennifer Horowitz | 07/10/2008
This article may not make me real popular with many site owners, but it is the honest truth. So many people want top rankings but they aren't truly prepared to do what it takes to get those top rankings.

Protecting Your Search Engine Rankings
By: Filomena Serraino | 07/10/2008
Are you getting your share of traffic from the major search engines?

Viral Marketing is the New Wind, Blowing Thru the Internet Marketing Industry
By: Carl Goodnight | 07/10/2008
This article deals with one of the ways that offers can be promoted to potential buyers, who don't want to use Google Adwords campaigns. It offers the potential to far surpass the effectiveness of an adwords campaign at about 1/10th the cost. One of the programs gives you access to a growing mailing list, without you having to go thru the trouble of building one yourself.

Self Promotion - Promoting Your Website Without Spending Anything
By: Hayden Tomas | 07/10/2008
There are hundreds of directories and search engines online containing millions of web pages. If you want to look for a website, then you will need to do a search. You need to submit your site to these directories and search engines in order for people to find you.

How to Focus the Marketing Effort for Your Top Home-based Business
By: Mike Muir | 07/10/2008
We discuss simple tips to focus the marketing efforts for your Affiliate Marketing programme.

Monitoring Search Engine Positions
By: Filomena Serraino | 07/10/2008
Are You Getting Your Share Of Search Engine Traffic?

More from Efren A.

Do You Want To Fire Your Boss?
By: Efren A. | 27/04/2007 | Business
This explains how to fire a BOSS or quit from job. The reader will learn the affiliate marketing. He will know what are the benefits of affiliate marketing and what are the affiliate programs to join. Yes! You can fire your Boss and make yourself your own Boss! Promoting or selling other...

Building Your Own Website Is Easy
By: Efren A. | 27/04/2007 | Internet
Website building, web development, how to build a website, domain name, hosting, web design The reader will learn here how to build his own website even he is a newbie in web development. Building a simple website is easy, even for non-IT people. If you have the following basic requirements, then you...

Top 7 Tips To Succeed In Affiliate Marketing
By: Efren A. | 27/04/2007 | Business
Promoting or selling other people's stuff in your website can make you earn a comfortable living that will give you confidence to quit from your job! You can do that by joining affiliate programs. Here are the top 7 tips to succeed in affiliate marketing: 1. Join Google Adsense. I recommend...

Article Categories






Give Feedback

Sign up for our email newsletter

Receive updates, enter your email below