Quote:
Originally Posted by Capo64
Thanks for the link. After all my searching I still don't see how CSS layouts are so much better, and I think I'm just gonna use a table layout.
So much less complicated and does everything CSS does (I think).
|
I also only used only tables in the beginning. I sometimes still do, but I always use CSS to style the tables instead of just HTML.
For example, you can create a 3 col table layout with a header/footer and set all the sizes, colors etc with an external stylesheet.
Example:
HTML Code:
<html>
<head>
<title>3 Col CSS Table Layout with Header and Footer</title>
<!-- Path To Your External Stylesheet -->
<LINK REL="stylesheet" HREF="style.css" TYPE="text/css">
<!-- / Path To Your External Stylesheet -->
</head>
<body>
<!-- Table -->
<table id="main-table" align="center" cellspacing="0" cellpadding="0">
<tr>
<td id="header" colspan="3">
Header
</td>
</tr>
<tr>
<td id="left-nav" vAlign="top">
Left Nav Links
</td>
<td id="main-content-area" vAlign="top">
<h1>
Main Content Area
</h1>
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
</p>
</td>
<td id="right-nav" vAlign="top">
Right Nav Links
</td>
</tr>
<tr>
<td id="footer" colspan="3">
Footer
</td>
</tr>
</table>
<!-- / Table -->
</body>
</html>
1. Use PHP or SSI includes for:
- Header
- Left Nav
- Right Nav
- Footer
2. Add style rules to each id attribute into the external stylesheet (style.css).
Example:
Code:
body {
margin: 1em
}
td {
font-family: verdana, tahoma, sans-serif;
font-size: 80%;
}
table#main-table {
width: 750px;
}
td#header {
height: 120px;
background-color: #35005A;
padding: 10px;
color: #AC7CCF;
}
td#left-nav {
width: 130px;
background-color: #35005A;
padding: 10px;
color: #AC7CCF;
}
td#main-content-area {
padding: 10px;
line-height: 160%;
}
td#right-nav {
width: 130px;
background-color: #AC7CCF;
padding: 10px;
}
td#footer {
background-color: #AC7CCF;
padding: 10px;
text-align: center;
font-size: 11px;
color: #35005A;
}
This provides much more flexibility because you can change the appearance of hundreds of web pages by changing just one file (the stylesheet). More info here:
http://www.htmlhelp.com/reference/css/
When combined with PHP or SSI includes, CSS is the way to fly.
Even though it's bit slow when started out with this, it *is* worth it because of all the time saved later. It gets easier the more you do it.
