# why css?



## jtn3833 (Dec 29, 2000)

I'm still a novice when it comes to css, at this point i'm still using tables inside of div's. i know it's wrong, but i'm not sure why. 

almost all of the browser incompatibility issues i run into are because of css, so i end up with lots of extra code to make sites work in ie.

i am aware of the many awesome aspects of css, but i'm just wondering why tables inside of div's is so bad if it seems to work cross-browser?

thanks,
jtn


----------



## ehymel (Aug 12, 2007)

In my mind the main reason is lack of flexibility in layout (for tables). If you change the layout in the future, it can be quite simple in css while requiring an entire re-design of tables. Many sites also allow users to select their own theme for layout, again easy with css but not with tables. Along these lines, designing for various formats (screen, print, mobile browsers, tablets, etc.) often require different layouts, once again easy with css but not tables. Further, dynamic sites (using ajax or jquery, for example) benefit greatly from css techniques.

I'm sure someone else can weigh in on some more technical reasons, but these are enough for me.


----------



## Ethanw (Jan 27, 2010)

Divs and tables are very similar, except divs only have one cell.

```
Content Here
```


```
[TABLE][TR][/TD]Content Here[/TD][/TR][/TABLE]
```
Both of the above output the same thing (or very similar). However, CSS can be used on Tables too:

```
[TABLE][TR][TD]Content Here[/TD][/TR][/TABLE]
```
However, DIVs don't support .

Conclusion: Each are very similar, with their advantages or disadvantages. However, TABLEs support CSS too, meaning that they are very similar to DIVs. However, CSS is more customizable, meaning that CSS can be a more powerful language to use. While TABLEs can have multiple cells, DIVs can only have one. So, they both have their advantages and disadvantages, and there is no definite answer.


----------



## rotarysteve (Dec 27, 2010)

For me, sometimes I wish I started using PHP.... not trying to throw in a whole new twist, but PHP could work very well for me with what I have.

If your page aint broke then don't fix it. Improve it. I think it all boils down to a level of 'ease of control'


----------



## namenotfound (Apr 30, 2005)

rotarysteve said:


> For me, sometimes I wish I started using PHP.... not trying to throw in a whole new twist, but PHP could work very well for me with what I have.
> 
> If your page aint broke then don't fix it. Improve it. I think it all boils down to a level of 'ease of control'


It's never too late to start adding it. If you think PHP will help, just add it.

When I first switched from a host that didn't allow PHP, to one that did (about 6 years ago) I had over 100 pages in plain HTML and CSS. Took a lot of time and effort, but I got them all switched to using PHP.


----------



## rotarysteve (Dec 27, 2010)

namenotfound said:


> It's never too late to start adding it. If you think PHP will help, just add it.
> 
> When I first switched from a host that didn't allow PHP, to one that did (about 6 years ago) I had over 100 pages in plain HTML and CSS. Took a lot of time and effort, but I got them all switched to using PHP.


Thank You, It is a chore though, :up:

I agree.... I just have to buckle down...

Not up to 100 pages, but a bunch....


----------



## sepala (May 20, 2010)

Have to agree with ehymel and Ethanw. Anyway, tables are not too friendly as ehymel said, and it takes time to make adjustments and there is no exact answer because there are advantages and disadvantages in both, as Ethanw said.


----------



## Ent (Apr 11, 2009)

I think that Ethanw's facts are valid, you can use both CSS and conventional formatting tags on both divs and tables. It is certainly proper practice, if you use those elements for what they're meant for. Tables should be used for displaying tabular data such as score sheets or timetables, divs for displaying general content. However it is not a good idea is trying to use a table to _structure_ your page.

Ehymel is correct, one of the big disadvantages with a table based layout is the difficulty you have in modifying it. Even given a decent WYSIWYG editor (which by the way still produce quite poor HTML code) it's hard to make changes to a table layout. A change to one cell will often have unforeseen consequences on the other cells. It also needs to be done individually across all pages, as all pages have the table built in. By contrast CSS promotes a more modular design -- each element is dealt with almost independently -- which makes it easier to modify. It is also stored in an external file, so only that one file has to be changed to affect all pages on the site.
A second problem is that it can be difficult to scale a table to different screens.
A third is that your layout is then intertwined with your data, which is against a precept of good web design where data, layout, and activity are all dealt with separately. This is related to the first problem.
A fourth problem which may be more a matter of principle is that people with screen readers have problems interpreting tables, so they cannot use your site.


----------



## sepala (May 20, 2010)

Ent said:


> A second problem is that it can be difficult to scale a table to different screens.


You mean different sized monitors? As a solution to this matter, we can use the standard width 800px, and make the site CENTER. Anyway, this solution may not suitable for designers, who want their site to have 100% width.


----------



## Ent (Apr 11, 2009)

sepala said:


> You mean different sized monitors? As a solution to this matter, we can use the standard width 800px, and make the site CENTER. Anyway, this solution may not suitable for designers, who want their site to have 100% width.


I beg to differ. As a designer you want your site to look its best whatever your viewer (or client) has to use. For any arbitrary size, you run two risks. If the monitor is too small, your layout will fail. If the monitor is too large, it will both *appear *pathetically small in proportion to their screen and possibly *be *too small due to a finer pixel size. A good site is set up to work as well as possible with whatever the person happens to have.


----------



## sepala (May 20, 2010)

Ent said:


> I beg to differ. As a designer you want your site to look its best whatever your viewer (or client) has to use. For any arbitrary size, you run two risks. If the monitor is too small, your layout will fail. If the monitor is too large, it will both *appear *pathetically small in proportion to their screen and possibly *be *too small due to a finer pixel size. A good site is set up to work as well as possible with whatever the person happens to have.


800px width and 600px height are standard sizes for web site(Of course, none of us are following , specially the height!)..Actually as developers, there are some situations which we cannot take the SIZE thing in to our hands. I have met some clients who want that 800px thing to be applied to be their site(They didn't say 800px, but that is the idea they had). It is their site, so I cannot take stuffs to my hand!! There is another thing to say. There are some developers that who really like to create their sites in 800px width and make them center. These are technology related stuffs, so taking suitable decisions in those issues are certainly up to the designers.


----------



## rotarysteve (Dec 27, 2010)

One thing might be to have decent tracking software as I use two different tracking software. With that one can see what visitors are using. I listed results from the two, the first is less accurate as the time window is much smaller, the second set should be much more accurate for my site.

First tracker

46.72% 1024x768 
26.00% Unknown 
12.68% 1280x1024 
8.46% 800x600 
3.81% 1152x864 
2.33% 1600x1200 

Second tracker

1024x768 - 30.62%
1280x800 - 13.74%
1280x1024 - 12.96%
1440x900 - 6.16%
1680x1050 - 5.56%
1280x768 - 5.50%
800x600 - 3.31%
1152x864 - 3.25%
1366x768 - 2.93%
1920x1200 - 2.11%


----------



## namenotfound (Apr 30, 2005)

rotarysteve said:


> One thing might be to have decent tracking software as I use two different tracking software. With that one can see what visitors are using. I listed results from the two, the first is less accurate as the time window is much smaller, the second set should be much more accurate for my site.
> 
> First tracker
> 
> ...


So no one visits your site that uses my resolution?
2560x1440


----------



## rotarysteve (Dec 27, 2010)

namenotfound said:


> So no one visits your site that uses my resolution?
> 2560x1440


Yes, looks like there was 1 visitor with 2560x1440 on 11/11/10 and looked at 4 pages. I only listed the top ones in the second set because I show over 123 different screen resolutions, which seems unbelievable. The largest I see is 3200x1200 and smallest is 234x278. I do use 800 width pages, but the site is 6 years old when the 800x600 was a little bit more common. Gosh, 800 would be a blip on a 3200 width.

My site doesn't get a huge numbers of hits but not too bad.


----------



## DrP (Jul 23, 2005)

For several years it has been considered good practice to separate style from markup, and CSS is the way to do that. The advantages are numerous and a quick Google should provide enough reason.

What I find worrying is that people on here seem to be learning to build websites using tables and seeing CSS simply as an alternative option. It isn't just an alternative option - it is the only option, and anyone wanting to help out people new to the development community should be making this clear. No serious developer should be using tables for page layout, and anyone looking for paid employment in the sector would be advised not to have any in their portfolio.

Tables are for tabular data. CSS is for page layout.

I wrote an article on this a few months ago: Naughty Tables


----------



## colinsp (Sep 5, 2007)

drp said:


> for several years it has been considered good practice to separate style from markup, and css is the way to do that. The advantages are numerous and a quick google should provide enough reason.
> 
> What i find worrying is that people on here seem to be learning to build websites using tables and seeing css simply as an alternative option. It isn't just an alternative option - it is the only option, and anyone wanting to help out people new to the development community should be making this clear. No serious developer should be using tables for page layout, and anyone looking for paid employment in the sector would be advised not to have any in their portfolio.
> 
> ...


+1

Another thing is that with CSS your page styling is loaded once for all your pages and it therefore makes your HTML pages smaller and load quicker (this is why if you have common styling across your site you should use an external style sheet). Whilst a lot of people have broadband not all do and a fast loading site is something you should be aiming for regardless of how your visitor connects to the internet.


----------



## ehymel (Aug 12, 2007)

DrP said:


> anyone wanting to help out people new to the development community should be making this clear.


Absolutely agree!


----------



## namenotfound (Apr 30, 2005)

rotarysteve said:


> and smallest is 234x278.




Is that a computer or a smart phone? The smallest computer screen resolution I ever used was 640x480.


----------



## rotarysteve (Dec 27, 2010)

namenotfound said:


> Is that a computer or a smart phone? The smallest computer screen resolution I ever used was 640x480.


I'll look into that and see if I can match it up with the user.


----------



## rotarysteve (Dec 27, 2010)

Turns out to be a user of a Samsung phone and using motricity inc as the carrier. This happened on 11/30/10. Unable to match it up with a phone model tho. Looks like they used Opera as the browser.


----------



## rotarysteve (Dec 27, 2010)

DrP said:


> Tables are for tabular data. CSS is for page layout.
> 
> I wrote an article on this a few months ago: Naughty Tables


I did like the article.... when I first started my main site, it was pure table construction and using html 4.01 transitional. The table format was not the best to manipulate so, got a way from the tables and also graduated to 4.01 strict, then went with xhtml 1.0 transitional and it is now coded with xhtml 1.0 strict and validates. I know the w3c does not rule the roost for placement or popularity in the cyber-world, but I'm glad I progressed to the xhtml 1.0. Also I hand code the pages.... tho as it grows I might be better served using a wysiwyg and then clean up the code later.


----------



## sepala (May 20, 2010)

rotarysteve said:


> One thing might be to have decent tracking software as I use two different tracking software. With that one can see what visitors are using. I listed results from the two, the first is less accurate as the time window is much smaller, the second set should be much more accurate for my site.
> 
> First tracker
> 
> ...


Cool..What is the software steve?


----------



## sepala (May 20, 2010)

rotarysteve said:


> I do use 800 width pages, but the site is 6 years old when the 800x600 was a little bit more common. Gosh, 800 would be a blip on a 3200 width.


I have never maintained that 600px height


----------



## DrP (Jul 23, 2005)

rotarysteve said:


> I did like the article.... when I first started my main site, it was pure table construction and using html 4.01 transitional. The table format was not the best to manipulate so, got a way from the tables and also graduated to 4.01 strict, then went with xhtml 1.0 transitional and it is now coded with xhtml 1.0 strict and validates. I know the w3c does not rule the roost for placement or popularity in the cyber-world, but I'm glad I progressed to the xhtml 1.0. Also I hand code the pages.... tho as it grows I might be better served using a wysiwyg and then clean up the code later.


Good work, Steve. Have you thought about HTML5 yet? I started making the transition last year and haven't looked back. Not because I make the most of all the new features, but because it cuts down on so much bloat and I like the fact the markup describes the content.


----------



## sepala (May 20, 2010)

sepala said:


> Cool..What is the software steve?


Thanks Steve.


----------



## sepala (May 20, 2010)

DrP said:


> Good work, Steve. Have you thought about HTML5 yet? I started making the transition last year and haven't looked back. Not because I make the most of all the new features, but because it cuts down on so much bloat and I like the fact the markup describes the content.


Hi Drp,

do you have any idea about the and tags of HTML 5? I tried to use that, but unfortunatly It didn't work. Do they support only for the ogg format?


----------



## sepala (May 20, 2010)

sepala said:


> Hi Drp,
> 
> do you have any idea about the and tags of HTML 5? I tried to use that, but unfortunatly It didn't work. Do they support only for the ogg format?


Anyone have any idea?


----------



## namenotfound (Apr 30, 2005)

sepala said:


> Hi Drp,
> 
> do you have any idea about the and tags of HTML 5? I tried to use that, but unfortunatly It didn't work. Do they support only for the ogg format?


I wrote a blog on it a while ago. It's about but should be similar for

http://blog.eschultheiss.org/2010/05/html-5-video-h264-vs-theora-ogg.html


----------



## sepala (May 20, 2010)

namenotfound said:


> I wrote a blog on it a while ago. It's about but should be similar for
> 
> http://blog.eschultheiss.org/2010/05/html-5-video-h264-vs-theora-ogg.html


Read and understood. Thanks for the details. And ya, thanks for the converter which you have mentioned there...


----------



## namenotfound (Apr 30, 2005)

Glad I could help


----------



## sepala (May 20, 2010)

Your article is written in a blog in Blogger.com right? hmmmm....Blogger is not bad...


----------



## rotarysteve (Dec 27, 2010)

DrP said:


> Good work, Steve. Have you thought about HTML5 yet? I started making the transition last year and haven't looked back. Not because I make the most of all the new features, but because it cuts down on so much bloat and I like the fact the markup describes the content.




Thank You DrP, I did experiment with another level, but didn't upgrade. Don't really remember what I did work with, but, probably HTML5. That was a short while ago tho. Ya got me motivated DrP to look into some other options.....

BIG SMILE'S.......


----------



## DrP (Jul 23, 2005)

rotarysteve said:


> Ya got me motivated DrP to look into some other options...


Thanks - hope it makes a difference.


----------



## rotarysteve (Dec 27, 2010)

DrP, it does. 

Had to rack the ol' memory cells.... Most of which are in the fail mode, lol!!! 

I believe it was XHTML 1.1 that I was playing with. Bizarre that I just did a random check-up with an overide and it passed at the 1.1 past the overide.

Doesn't like the DocType overide, but that's easy.


----------

