With the upcoming release of IE8, which will support CSS
display:table and other table related display properties, I’m expecting changes in the way web pages are laid out. I just finished an intensive experience with Adobe Dreamweaver CS4 and the built-in CSS layouts that come prepackaged with the product. Naturally, my mind veered in the direction of those layouts. Okay, the truth. Actually, I’ve been having visions of Stephanie Sullivan (who created the Dreamweaver CS4 built-in CSS layouts) madly adapting all those page layouts to add
display:table layout options.
Well, I couldn’t wait for the next release of Dreamweaver to see what Steph might do (or might not do—this is only my fantasy—no idea if Steph is participating) to add to the layouts she’s already made for Adobe. I had to play around with it myself.
I started off easy. I picked a layout with two columns, no header and footer, and a fixed width. In the Dreamweaver File > New menu, this layout is called 2 column fixed, left sidebar. I got just a bit fancy by adding a div in the main content area that held two boxes or cells that use
display:table-cell in the CSS. There are colors and widths and other CSS rules from the Dreamweaver layout that I didn’t touch. I only removed the rules for layout and added new ones. Here’s the CSS for the layout:
padding: 15px 10px 15px 20px;
border:1px solid red;
Here’s how it looks. If you click the image, you’ll see the actual HTML page, which contains the CSS and comments that explain what I changed and did. Don’t expect the layout to look right with IE unless you have version 8. Use Firefox or Opera or Safari. Of course, you can view the source with IE6/7 to see the HTML and CSS.
The changes were super easy. Took no more than 5 or 10 minutes to do.
I tried something harder. This time I used the Dreamweaver File > New layout for CSS called thrColLiqHrd, which means a three column liquid layout with a header and a footer. You are probably aware that this type of layout is normally done with floats (which must be cleared). Sometimes this type layout also needs faux columns to get equal heights on the three columns.
In the HTML, I changed the source order for the three columns to
sidebar1, mainContent, sidebar2. I added a wrapper called
contentwrap around the three columns. This enabled me to display the three columns using
display:table-row. Similarly, the header and footer were designated as
display:table-row. The last change was to set each column to
display: table-cell. As with the first adaptation, I left colors and widths and other rules from the built-in Dreamweaver layout the same. I only changed rules affecting the layout. Here’s the CSS for the layout.
margin: 0 auto;
border: 1px solid #000000;
padding: 0 10px;
padding: 15px 0;
padding: 15px 0;
padding: 0 10px;
And here’s the result. If you click the image, you’ll see the actual HTML page, which contains the CSS and comments that explain what I changed and did.
This layout took longer to adapt, maybe 20 to 30 minutes. Plus, I made a few return trips to the book Everything You Know About CSS is Wrong! to make sure I knew what I was doing.
Even when IE8 releases, using layouts like these without conditional comments linking to IE7 CSS rules won’t truly be practical until all the older installations of IE have disappeared. For a while it will be like the bad old days when everyone used @import to create a stylesheet just for Netscape. Except, now we’ll use conditional comments to accomodate older versions of IE. We’re still dealing with the pain of creating extra stylesheets for browsers that don’t perform up to standards. Same old, same old. Sigh.
Yet. Yet. People will start playing with this more fully when IE8 releases. Here’s my advice to Dreamweaver users who are eager to start experimenting with layouts using
display:table properties. You don’t need to wait for the next release from Adobe to create some pages using CSS table layouts. Try adapting the layouts you have. It works.
Related posts: CSS Tables, Review: Everything You Know About CSS is Wrong!, Mastering CSS with Dreamweaver CS3
10 thoughts on “Adapting Dreamweaver CSS layouts to display:table rules”
i want to learn dreamweaver online free of cost
The first example doesn’t work in Safari (in SeaMonkey it is okay) Of neither will work in old EI. And DreamWeaver CS3 does render it correctly in design mode.
I look forward to using CSS Tables but until they are really supported I will stick to floats and html tables for now.
Correction to my comment, That should be DOESN’T render Correctly in DWCS3
The author’s frustration is so poignant I can feel it from way over here. IE8 is supposed to be great. But until then we’ll have to wait. IE6 required many fixes. Oh well. I have seen other folks jump the gun with exciting bits of new code authorized by W3C but not in use by web browsers. There’s not a lot to talk about CSS2 has gotten kind of stale as subject matter.
Keep in mind that when you start with an existing Dreamweaver CSS layout, you’ve already got an IE compliant stylesheet that can be used in a conditional comment. The only new work involved is setting up the rules for the display: table parts of the layout you want to try. It’s the most frustration free way to try something like this that I can think of.
The built-in CSS layouts are not very robust. Moreover, they contain IE conditional vomment version vectors that target ALL versions of IE, incouding 8. There is, of course, a way that you can use display: table for modern browsers and have it degrade gracefully in older versions of IE. Here is a quick example:
Thanks for chiming in, Al. If anybody can come up with a way to make Dreamweaver work right with display: table rules, it’s you.
Thanks for posting an article that is both useful and interesting to read.
Keep up the good work!
how to view the table in dreamweaver?
Not sure I actually understand your question. display:table does not create a table. Can you clarify a bit?