A frequently discussed subject Im sure.. I am fairly new to CSS (student) In the past I have always used tables for layout. For example I have an image library on one of my sites so obviously alot of images and text needing to be displayed in a tidy way. Im currently reading about 'positioning properties' in CSS and am wondering if this should be replacing my need for tables altogether? I am also confused about browser incompatibility problems this could create?
thanks.Yes, using CSS for layout is greatly preferred over tables. (Tables still have a use: for presentation of truly tabular material within your overall layout.) I have found most all browser compatibility problems can be addressed by using a strict DTD:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html.......
....../html>Tables pretty much kill your ability to make pages however you like. Css allows you to do a whole lot more (and if IE wasn't so f***ing sh** then we could even use it reliably to replace a considerable amount of javascript too.
Having said that though I've come across 2 things so far that should be extremely simple to do with css, but so far seem pretty much impossible.
CSS is still vastly better than using tables though. It grants you far more freedom and uses a fraction of the mark up.When you first make the switch from tables to css everything will seem alot more complicated and you may end up regressing to tables or doing what I see a lot of people do, which is to mix the two. However, once you learn css you'll realize that it affords you a lot more control, versatility and options in general that tables ever could, it simply takes a little while to get used to it.
Keep plugging away at it, and good luck.xhtml + css are two very good friends. You should get to know to know them very well They will help you.
thanks.Yes, using CSS for layout is greatly preferred over tables. (Tables still have a use: for presentation of truly tabular material within your overall layout.) I have found most all browser compatibility problems can be addressed by using a strict DTD:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html.......
....../html>Tables pretty much kill your ability to make pages however you like. Css allows you to do a whole lot more (and if IE wasn't so f***ing sh** then we could even use it reliably to replace a considerable amount of javascript too.
Having said that though I've come across 2 things so far that should be extremely simple to do with css, but so far seem pretty much impossible.
CSS is still vastly better than using tables though. It grants you far more freedom and uses a fraction of the mark up.When you first make the switch from tables to css everything will seem alot more complicated and you may end up regressing to tables or doing what I see a lot of people do, which is to mix the two. However, once you learn css you'll realize that it affords you a lot more control, versatility and options in general that tables ever could, it simply takes a little while to get used to it.
Keep plugging away at it, and good luck.xhtml + css are two very good friends. You should get to know to know them very well They will help you.