Electric Type

Multimedia

About Us

News

Help

Introduction to CSS Positioning
by Taylor 25 Jun 1997


Page 1

God, I love tables. Tell me if you can't relate: I start out with my table tags and make them, um, 600 pixels wide. Then I do my first row with four <td> cells. I'll put my content in the last one - those first three are just placeholders for later. Oh wait, it's not taking my <td> widths. Oh, well. I'll put a spacer GIF in there.

Now I'll do my second row. Oh, hold on. I didn't put in enough placeholder <td> tags. I'll have to go back and add some more. No, wait! I'll just make one of the <td> tags colspan=2. There, that does it. Now I'll put some images in and ... darn! The images aren't lining up flush. What's going on? I'll turn off all the cell padding. Shoot! That's still not working. Oh, that's right. I remember now. You can't have any spaces or line breaks in the table. So I'll have to put it all on one line. Let's see... MAN this sure makes it hard to read.

Let's face it: Tables suck. They may be great for representing tabular data fields, but when they're used to lay out a Web page, they are a kludgy work-around and one of the biggest abuses of HTML. So repeat after me: HTML is a structural markup language. It should not be used to control a document's visual appearance. Now repeat that 10 times before we continue. Go on, I'll wait. La de dah de dum de da ...

OK, so now that we've got that over with, you're probably asking yourself, "If I can't abuse tables, how am I supposed to keep my pages from looking like NASA's latest report on stellar dark matter?"

Well, if you're a longtime reader, the first thing that will pop into your head is cascading stylesheets. Using CSS, you can control the color, size, margins, and presentation of most objects found on a page. Of course, there are still many things you can't do without abusing them in the same manner we once abused plain ol' HTML. That's where the good folks at the W3C come in, with their proposal for positioning HTML elements with cascading stylesheets.

This proposal would not only allow you to place elements exactly where you want them, without interrupting the flow of your document's structure - just in case someone dares to look at your page with a Lynx browser or a cell phone. To further sweeten the deal, Netscape and Microsoft have included support for CSS positioning in their current browsers.

Positioning behaves much like Netscape's layers but offers much more flexibility and control. While layers require you to place specific tags around each element you intend to position, CSS can be applied to almost any element. And because of this flexibility, CSS positioning will become an essential tool for HTML designers, production jockeys, or software designers who are writing HTML tools (hint, hint).

next page»


Dynamic HTML  

Frames  

HTML Basics  

Stylesheets  

Tables  

XML  

Javascript  

Database Connections  

Intro To Perl  

HTML 4.0  

User Blogs

Screen Shots

Latest Updates

Contact Us

Valid HTML 4.01!
Valid CSS!

Breadcrumb

© ElectricType
Maintained by My-Hosts.com
Site map | Copyright | Disclaimer
Privacy policy | Acceptable Use Policy
Legal information.