Webdesign: Why use CSS

  • Hey - turns out IRC is out and something a little more modern has taken it's place... A little thing called Discord!

    Join our community @ https://discord.gg/JuaSzXBZrk for a pick-up game, or just to rekindle with fellow community members.

Martz

Staff member
May 26, 2001
5,707
63
A few people starting out in webdesign have asked for help with websites that they have created in Dreamweaver. It's difficult for people with a bit of experience to help the Dreamweaver users - since there is a good chance that they don't have it installed themselves.

So I thought I'd write a thread which explains some of these issues and the reasons behind then.

Why should I use Dreamweaver?

Dreamweaver at first seems to be the best way to go. Most of us would use Microsoft Word or some other word processor to write a letter. We wouldn't use notepad or wordpad that come with windows - because they are pretty shit. We want to visually see the website we are making, and if this is your first attempt to make a website you can get the software and set off creating your pages.
Everything seems to be going well until you ask for help on a forum and receive a load of flames from people who tell you that you're using the wrong software and should use notepad. It doesn't seem to make any sense that people are saying that to you, you just want to quickly make your site and be done.

Why shouldn't I use Dreamweaver/Frontpage/ProductX

There are lots of reasons peope will suggest without really giving you a real answer, mainly "it's shit" or "it's not the proper way to go". But that doesn't help you. You just want your website done ASAP.

But for this I'd like to give you an example:

The company I work for has their website which contains over 100 pages. This site was created for us by a "Graphic Design Company" and thousands of pounds paid for it. The finished result looks OK, we've got all of our content and images on there, links, and everything appears to be fine.

The problem now, 4 years on, is that the bosses want to change parts of the website and they want me to do it to save money. They only want to change the logo at the top of the page - not too have an entire new website. The problem is though that because we have 100 pages, it requires around 100 html files to be edited. 1 at a time. And if we want to change 2 or 3 things per page, thats now becoming 200 or 300 page edits in various places.

It gets so difficult to manage that you give up - and start again with your website.

Why is this? Why not just use Dreamweaver to update the site? Well we could, but as many of your have found out - Dreamweaver doesn't always do what you click it to do. It may screw the page layout up, or move things about that you don't want.

Enter CSS - Cascading Style Sheets
It all sounds a bit complicated - but it is so much simpler that using Dreamweaver. It just costs you some time and effort to begin with to learn what all of these weird commands are and how it all works.

The basic idea of HTML and CSS is this.

Each of your HTML pages (1,2 5, 10, 100, 1 million of them) reference a single file called style.css. This file contains ALL of the style and layout information for your site. It dictates the colours of the text, backgrounds, if a box floats to the left or to the right, the width and height of a box, the size of text. Everthing.

You'd have these files for example:

index.html
contact.html
games.html
pictures.html
style.css

The HTML files just have pure content and the markup which gives names (class and ID) to various parts of your HTML and helps to identify them.

So to recap - HTML is for content, and CSS is for styles. Mixing them all up together in 1 document makes it hard to make changes later (since you have to edit every page)

Starting out with the basics of CSS
So You could make a header, content and footer section for your site and name them accordingly.

Example of a HTML page:

<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
</head>
<body>
<div id='header'>Welcome to My site!</div>
<div id='content'>Here is the main content for this page</div>
<div id='footer'>Copyright Me 2007</div>
</body>
</html>

Once each part of your HTML has an id or a class name, you can then use CSS to make each section of your site looks and how it is positioned.

Example of the CSS file

#header {
color: red;
font-size: 36px;
background-color: blue;
}

#content {
color: gray;
font-size: 12px;
border: 1px solid green;
padding-left: 50px;
}

#footer {
text-align: center;
background-color: yellow;
}

Now the layout of the CSS above might seem strange, but the attributes for each #section are simple to read. Color, font size, background colour, padding etc - are all quite obvious.

Since you only have 1 CSS file that is linked to all of your pages - 1 edit to your CSS file will update every single page in an instant. You can also include background images - such as your header logo. 1 Change to the CSS, and your new logo is updated on your entire site.

You could make those 4 lines of code within the <body> </body> tags look simply amazing with images and colors.

HTML and CSS alone doesn't solve the problem of updating your website and copy/pasting code. This is where a PHP can help you, you can then include a header and footer pages into each document so that you never repeat any code - which I might write a guide on later.

Some websites which demonstrate CSS

The most famous of these is the CSS Zen Garden

They have 100's of different styles, some absolutely amazing ones. They look very cool and have lots of graphics. The point of this though, is that the HTML for every single one of these pages is exactly the same apart from 1 line - the CSS file that they link too.

If you open 2 or 3 of the different designs and view the source code - you'll see that the HTML is exactly the same. Without a stylesheet it is extremely boring, white pages, black text, not even a font is used. However when one of the stylesheets is used - the appearance changes massively, so dramatically its hard to believe that it's all be done with just a CSS file.

This also adds another benefit which is that anyone who is using the internet with disabilities (i.e. they are blind and they have some software which reads out of the words in a computer voice to them) can choose to ignore the style and instead just view/hear your content. With a Dreamweaver website, the software would be reading out all of your style information rather than the content.

It also means other devices such as mobile phones can either ignore the style so that it fits onto their screen, or you can even make a stylesheet which works just for mobile devices. You can make a stylesheet for printing which hides stuff that you wouldn't really want printed - like menu links and adverts.

CSS really is the powerfull and flexible way to work. But better than that, people can actually help you. Because its simple and understood by many people - anyone with CSS knowledge can take one look at your website and tell you where you are going wrong or how to do something.

Personally I would much rather help someone who is using CSS - because I'm helping them to help themselves. Trying to fix someones dreamweaver site is annoying to me, because there are better/quicker/easier ways to achieve what they want - and therefore its a waste of my time - because eventually that user will progress to CSS design themselves. No frames, no software applications, or specific code which nobody apart from Dreamweaver or Frontpage understands.

I've used Frontpage and Dreamweaver since they were first launched no the market - it was my gateway to webdesign. But I spent hours and hours and hours clicking around trying to make my site in a way that I wanted - but the software wouldn't let me. As a wannabie web developer I was restricted to what software could and couldn't do. All that time I wasted until I discovered CSS, and I threw out what I thought I knew and started again.

Tips
  • Use Firefox for developing your sites
  • Get the WebDeveloper extension which can help you work out why things aren't working as expected
  • Check your sites in Internet Explorer, Opera andother browsers/devices to make sure they all look the same (they won't, since IE generally does things differently - and this is why so many webdevs hate its guts).
  • Google for CSS design, templates, layouts, tricks. There is so much stuff on the net documented about this compared to Dreamweaver or Frontpage. The help is out there and you can easily teach yourself with some time and patience.
  • One step at a time, take it easy and try and soak up what you are doing. Don't copy and paste other peopels stuff because you won't understand what you've done - and you'll probably end up breaking it later and won't be able to fix it
 
Really good post Mart. Very informative and intersting and some of the styles on the css zen garden site are really nice.

Saus, from wot i have learned just by reading martz's post (i could have interpreted wrong), CSS style sheets simply dictate how the html code is presented and formatted. I.e without a CSS style sheet you could still understand the html content being displayed through a web browser, but it would look totally crap as it would have no formatting -no fonts, colours etc etc
 
Exactly right Gaz.

HTML is wrapped around content (words/images/stuff) to tell the browser what it is (its a link, its a table, its a section of words named 'header'). It defines each part of the web page and it's content.

CSS makes HTML look pretty by adding attributes to it, such as text colours, borders, spacing, background images and its layout and position.

Example, my "header" is 200 pixels high and 100% the width of the browser, has a red background with blue text and the page colour is gray.

You could use a style you find on the internet, however it might not match up to all of the HTML code you have. I might call the bit at the top of my page "header" whereas you might call it "logo-holder" or something different. There is no restriction on the ID or CLASS names you use for each of your HTML elements (bits), so you can call them what you want. This means that stylesheets are not always transferable between sites because everyone makes them different. That isn't really the point - the main point is:

Seperate your content and style.
 
Last edited:
Dreamweaver FTW! It can be used by newbies and professionals. It has a great possibilities to standarize your pages (templates), supports almost all common web related file formats with proper code highlighting (css, (x)html, php, asp, tpl, javascript and lots of more). Having not much of an idea about pure code you can use mixed mode like code/design or just design. Experienced users will most probably use code tab only. It has a good manual system for all supported coding standards (tag list for html, css, etc.).
By all the years of my work i tryed tons of other editors and Dreamweaver easly won and beat the competition.

Of course there are better several other specific editiors only directed in support one specific language (Zend for php, Visual Studio for ASP) but you won't see good support for rest like javascript or css in them.

Another great feature in dreamweaver are "Sites". It's simply your projects manager with built in ftp client. It makes your work even more faster. Just configure it once and then everytime you press CTRL + U it'll be uploaded to your configured server instead of switching to other soft just to send one file.

There are tons of other options but they won't be very useful for just one simple site. I'm talking about group work stuff where many ppl can work on same stuff at a same time ... but that's a option for more advanced user working in teams.

I would recommend Dreamweaver among any other editors for all levels of coding skills :)
 
If there is the need for a "WebDev forum" then I'll add people with a clue as Mods so they can edit the post in a Wiki style. Noticed loads of typos n stuff, but I think it gets the message across.

Please, no more arguing about Dreamweaver Pros and Cons either.

I had a quick moan at Brajan about his post, but it adds balance to the thread. I'd like to stay on the topic of "CSS" design rather than "Dreamweaver" design/used as an editor etc.
 
Last edited:
could we have a php one :drunk:

edit: ok i just saw this ...

Martz said:
HTML and CSS alone doesn't solve the problem of updating your website and copy/pasting code. This is where a PHP can help you, you can then include a header and footer pages into each document so that you never repeat any code - which I might write a guide on later.

DOO ITT!
 
Last edited:
btw:


Mozilla Dev Center

This helped me a lot, some of the attributes you can just guess like "height" and "width" but knowing to use font-family or something isn't immediately obvious :D. In particular the CSS reference part is a good resource for beginners and experts alike :thumb:. Maybe wanna add a linkage section to your post / future wiki :D
 
Last edited:
pruned the thread.

some good references material:

Eric Meyers book if your serious about css you should get it

Meyers lists of CSS materials

Cascading Style Sheets: The Definitive Guide, Second Edition a second must have.

W3C learning CSS list

http://del.icio.us/ search for CSS and web dev etc its a great source for specific css problems too as you can just search for your problem and most of the time someone has tagged it.



my 2 personal bibles are

A List Apart

Humanized

Everything on those 2 sites is useful and will make your creations better.



A few tools I use
Firefox webdev tool bar add-on

Mac text editor the best text editor there is.

Free Dreamweaver type app for those that want that functionality


there are lots more but most of them are mac only and this forum doesn't have many mac people.
 
Last edited:
A lot of people always want fancy dropdown menus and quickly resort to javascript or the likes, here is a CSS only drop down menu (demo).

<rant>
Personally when it comes to websites I do believe in "less is more", especially when it comes to technology used.
A site which is flash-only is the absolute worst possible if you ask me. It totally encapsulates all the content and makes it inaccessible to get to it. You can't search through it, thus a searchengine can't properly find/index it. It's not (easily) accessable for disabled people. Even if you stay clear of flash all the other fancy stuff like AJAX are still bad if you ask me. On mobile devices it will fail and once more probably for disabled people aswell.
Not to mention all that extra stuff is just adding layers and layers to seperate you from the content itself.

My advice is to just use the latest version of xhtml and css. Nothing else. Well... notepad, but that's it.
</rant>
 
Iv seen many posts say not to use "Dreamweaver", but use "notepad".
With Dreamweaver you can use 3 different screens.
1)Code
2)Split
3)Design

if people used the Code Screen, it works the same as notepad, then a little click onto the Design tab will let you see what it looks like.