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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

why use div

Status
Not open for further replies.

wolf73

Programmer
Feb 12, 2006
93
CA
Hi,

I was wondering some people instead of constructing their page using tables use div statments. Whats the advantage of using <div>? Isn't it that div statemnet cause some problem in Netscape ....
 
It did years ago in the Netscape version 4.x family, but that was before the <div> was made part of the HTML standards, I believe.

Lee
 
I don't think I have seen a browser that had trouble displaying divs. Divs have been part of the html spec since v3.0 so every browser should have no trouble showing them.
 
Yep, as someone that recently moved away from tables to DIV's i can highly reccomend it.

Once learned designing sites in CSS is so much quicker. you also have the benefit of very clean and organised code which means you can properly organise your contact with <p> and <h1> <h2> and <hr> tags ect, which makes alot more sense.

I also here that you're going to benefit with Search Engine Rankings for having this code better organised.

If you havnt gone CSS yet then i would highly reccomend it.

Rob
 
TamedTech said:
I also here that you're going to benefit with Search Engine Rankings for having this code better organised
Just a myth. There are many reasons to use clean organised code. SEO ( forum828 ) isn't one of them.


Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
People Counting Systems

So long, and thanks for all the fish.
 
There is a learning curve when switching to using table-less layouts. Certainly tables are far quicker to knock up a basic design for some people, or for those who aren't too confident with using CSS.

However, as Rob points out, once you've got the gist, there are many benefits:

- (generally) improved loading speed, due to less markup, and caching of CSS files
- better SEO
- better portability
- better accessibility (although simply going table-less doesn't mean your site is accessible)

There are many sites that give good advice, and even templates, showing you how to do common layouts in CSS... so if you ever get stuck with this, it shouldn't be too hard to find examples of how to get around common problems. And of course, you can always asks here!

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
TamedTech can you send me a URL of a website which you built and has used CSS. I know websites only in HTML
 
wolf73,

You might be mis-understanding. You use HTML to build websites. Period.

CSS is simply a way of telling the HTML on the page how it should look. It is not a substitute for HTML.

To really understand how using CSS to lay out your pages is different from using, say, HTML tables, you need to use a browser that lets you turn off style-sheets. I recommend downloading Firefox, and installing the "Web Developer Toolbar" from Chris Pederick. Once installed, you can turn off all styles to see a page "au naturel" (i.e. just as plain HTML).

Sites whose layout is achieved with tables generally look quite hideous with styles turned off (this one included). Sites whose layout is achieved via CSS generally look a lot more understandable, and easier to follow the flow of the content. Take this recent site we built:


It's a good example of what I'm talking about. If you turn styles off, you can still read the content in quite an obvious way. Nothing is hard to understand. Turn styles off on this site, and you'll be struggling to work out what is where.

While humans might be able to understand sites built using table-based layout with no styles, screen readers can often have a much harder job.

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
thanks......... i actually did use CSS, but it was with tables...not with Div . Instead of having font for each <td> I was using CSS class........

Thats the only way I have used CSS so far ......
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top