.: Creating Your Own Web Page is Easy - A Tutorial (Part 2)

By:Hardi Budd

Category:Home / Internet / Web Design

Now, Let's continue with Part 2. We will discuss the following here:



Creating tables

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, 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.

Digg del.icio.us Blink Stumble Spurl Reddit Netscape Furl

Article keywords: website building, web page making, creating a web page, make web page, how to create web page, how to design web page, how to make web page

Article Source: http://www.articles32.com

About the Author:
Hardi Budd is affiliated to www.freetipsandwits.com and free-website-tips-guides-tutorials.blogspot.com that offer Free website tips, guides, tutorials and web resources for affiliates, internet marketing, online business, search engine optimization, website promotion and internet security. Supported with affiliate programs, freebie directory, add URL, link exchange, english tagalog jokes, news and more.

This is free for republishing as long as the author byline with active link to our sites is retained as-is.





.: New Web Design Articles

1). HTML Might Become Obsolete
Web designers are beginning to dump HTML in favor of more versatile web programming languages

2). Macromedia Dreamweaver: An Introduction
Getting started with your first web page can seem very daunting indeed. Macromedia Dreamweaver is the industry leader in web editors, but knowing where to start and what you need to know can be a little confusing at first.

3). Finding A Good Web Designer
Avoid the mistakes I made when I hired someone over the internet to design my web site

4). Top Tips for Getting Free Websites
There are millions of opportunities of earning money online, but for that you frequently need to have a web site and there are many people interested in how to build a web site online for free. So whether you want to build a free business web site or to build a Yahoo-like web site, you can be sure there are plenty of online guides, such as this, to take you step by step through the process.

5). Is Your Web Site Driving Away Visitors?
Much has been written about optimizing your web site for search engines, but less emphasis is placed on usability. Optimizing for usability and for search engines is not a contradiction.

6). Choosing a Web Designer
freelance web designers are rip-off artists

7). HTML Sitemaps Are Still Important
An html sitemap is one that humans and search engines both can read. Google sitemaps are important too, but they are specific to google and are read only by a search engine.


.: Top Web Design Articles

1). Advanced Joomla Templating (pt1) Using Module Class Suffix
an article from User Written Resources 1. duplicate the styles already used for the particular module, adding a suffix to each style name. this will definitely include some of the following; 1. .module {} 2. div.moduletable {} 3. div.moduletable h3 {} 4. table.moduletable {}/li> 5. table.moduletable th 6. table.moduletable td and can include other styles used on the content in that section, such as; 1.

2). How To Make a MySpace Layout That Stand Out
If you are a MySpace user, you have learned what an easy to read and fun profile looks like. The only problem is, you may not know how to create or find out. Most of the time when you see an awful MySpace layout, it's because its sloppy, hard to read, or has annoying links you didn’t even see. That is because since MySpace has been growing so much, so have the layout sites.

3). Professional XOOPS theme design - What to look for
In general, prices for theme design work will range depending on a number of factors. If you don't mind the designer releasing the theme on their site for others to purchase, then you can expect anywhere from $20US to $50US for your theme. If the theme must be a one of a kind theme that only you use, you could expect to multipy the fee by at least 10x.

4). Adsense: The Smart Investment
Over the last 2 years, We have been building a Virtual Adsense Empire of over 500 websites and making some good money. We've also been building content sites for clients using the same system. The system we use is not something that produces 1000's of sites with a click of a button, our system does not build spam websites, nor does it produce the same sites you see over and over and over again.

5). Irish Graphic Design Industry
Graphic design is the use of color, light, balance, contrast, emphasis, proportion, proximity, repetition, texture and a plethora of other elements to create a work of digital art that is pleasing to the eye. Graphic design is about seamlessly molding image and text to convey a theme, message, or often advertise a product or service. Graphic design dates back to prehistoric times.

6). How to Create a Splash Page for Your Website?
These splash designs prove to be quite popular, especially among the designers as they allow the designer to show their skills in flash and any other technology on a single page. The splash page design involved in the splash page will be one that is very attractive to the eye of the viewer. Its main intention lies in captivating the viewer the moment he looks at it.

7). Does Your Web Design Include Background Music?
When you design your website, you may wonder whether or not you should include background music in your web design. The answer to this requires you to ask two additional questions:


Page loaded in 0.529 seconds.