Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A question about CSS vs HTML

Status
Not open for further replies.

rileypetty

Programmer
Jan 20, 2007
43
US
I've been debating whether or not to ask this question for some time. Here goes. When I see a website that I like I usually look behind the screen using View Source to see how someone designed or did the layout of the site. I’ve been doing ASP, CSS & HTML for a while but with tables. It seems fast and easy to me but occasionally when I look at a site I see a lot of the layout work done with DIV tags and CSS only. Is there an advantage using DIV tags vs. tables? Is it faster or load faster? Or is it just preference? Just curious.
 
If you simply Google table layouts vs css layouts you will find more reading material than we can provide for you here. I personally enjoy browsing through this presentation:
At this point it is not even all the good points of css based layouts that make me use that technique. I find it much more intuitive than having to create invisible tables. My mind creates blocks around the page, not table cells.

___________________________________________________________
[small]Do something about world cancer today: Comprehensive cancer control information at PACT[/small]
 
Thanks, your second paragraph was exactly what I was looking for. I've started coding some DIV's with CSS on some of my pages but I was just curious why people were doing it that way. I think sometimes I get so used to doing things a certain way I don't think about changing until I stop and look at what other people are doing. Thanks again. Riley
 
The advantage of CSS for me is the ability to have total control of a page's layout. I spent many years avoiding CSS in favour of tables, using the argument that 'tables work and CSS is awkward'. I am glad I made the effort to get my head round CSS as it makes life so much easier. I am in the process of re-writing my own site which at the moment is very much table based but work keeps getting in the way. I have never had any luck with absolute positioning but have managed so far without it. I looks to me like something which would break very easily so I avoid it.

Tables are still a useful tool for tabular data but, for me, that's their only purpose.

Keith
 
I've worked with absolute positioning on some drop-down menus and did not have too much trouble. What are you referring to regarding absolute positioning? Riley
 
Absolute positioning is a very powerful set of methods to achieve great results when used appropriately. However, most users take the words "css positioning" too seriously and they believe all elements should be positioned -- and since relative positioning is even harder to understand, they end up absolutely positioning their entire page. That is not a good approach.

In addition to what I said above, I find it incredibly important to write semantic pages. That means that I would (strive to) use the best element for its purpose. Tables works best tabular data, divs for specific portions of the site, headings for titles, paragraphs for text and lists for navigation, galleries and such.

___________________________________________________________
[small]Do something about world cancer today: Comprehensive cancer control information at PACT[/small]
 
I tried absolute positioning when I first started with CSS. I was getting frustrated with the different browsers giving different results. It was probably me doing something wrong but since then I have not found a need for it as I normally use a fluid design which works for me. I will have another go at it, when time permits, just to put another tool in the tool box. Who knows, once I have mastered it, I may well wonder how I ever managed without it.

Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top