CSS and Clients w/ Dreamweaver
So, your client wants to use Dreamweaver? Yeah, I'd be scared too. Dreamweaver has always been a pain in the side of standards evangelists. I've been building sites according to W3C's standards for quite a while and have found that Dreamweaver is not the optimal tool for me to use when it comes to creating sites. I just prefer to have more control of the code, and it runs extremely slow compared to my preferred editor.
In order to keep the client from damaging the design when editing, I used Dreamweaver's templates (dwt). That seemed to be an obvious solution to that issue. When I finished developing the layout of the site and it tested it in Firefox, IE, Opera, and Safari, I looked at it in Dreamweaver MX (the version of Dreamweaver that the client was using) and it sucked. Objects were overlapping, image replacements weren't always working, it was a nightmare. They couldn't upgrade because it was a large scale company and it would have been a big ordeal for them. The last thing I wanted to do was code the site all over again using tables. I did a bit of searching to try and come up with an idea but I didn't find any. So, I started looking into other ways to make this work.
For the purpose of this article, I am going to use this site, CreativeRuin.com, as an example. Take a look at how it looks in Dreamweaver MX, Dreamweaver MX 2004, and Dreamweaver 8. I am glad to say that Dreamweaver 8 seems to be working a lot better than the other two, but since my client is using Dreamweaver MX, I have to make it work in there.
There have been some mentions of Macromedia borrowing from Opera's rendering engine in the MX 2004 version, but it seems like the bulk of Dreamweaver's rendering engine has been built on their own. Dreamweaver didn't seem to have any proprietary conditional code that would help and it doesn't seem to render IE's Conditional Comments either. So, I started looking at what Dreamweaver does render. I found that Dreamweaver, at least from MX to version 8, renders some of the same bugs as IE does. Such as the * html rendering bug. It can also render more advanced selectors such as html>body, which PC IE versions 6 and below can't. Since the client would only be editing the content area of the site anyways, they only need to see that section. It's formatting is pretty simple and they shouldn't run into all the layout issues the rest of the site.
So here's the solution
- First, attach this code to the head of your html document.
- Next, create Dreamweaver.css. This file contains one line of code:
@import url('dmx_fix.css');Keep in mind, @import url('dmx_fix.css'); does render in PC IE but it does not render in Mac IE. - And finally, create dmx_fix.css. This file contains the CSS that cleans up the display:
* html>body { position:relative; } * html>body #container-wrapper { display:block !important; width:10px !important; height:10px !important; position:absolute !important; left:-900 !important; top:0 !important; } * html>body #container-wrapper #pagecontent { position:absolute !important; left:910 !important; top:10 !important; width:369px !important; background:#fff; }Note that the left property of the container-wrapper is 10 less than the left property of the pagecontent.
<link href="dreamweaver.css" type="text/css" rel="stylesheet" media="screen" />
The * html>body selector {} normally would only apply to Mac IE, but since I used the @import url('dmx.css'); which doesn't render in Mac IE, both of them combined only render in Dreamweaver (as far as I know). Essentially, I'm hiding all of the elements of the site from Dreamweaver except the content the client needs to edit. I'm also keeping the properties of the content container the same, such as the width, so it matches the site as it looks in the browser and there are no surprises once the file is published.
Take a look at the results.
What do you think of this approach? Would you find this acceptable or would you have re-coded the site with tables and not followed the semantic approach?
elQueFaltaba
May,20,2006 05:20