Question:
Is it possible to remove the table borders completely in HTML?
?
2010-04-05 19:12:02 UTC
Hello,

While you can set the table borders to "0", they still remain there as an "invisible margin" of ~2px size. I would like to know if these marginal borders can be removed completely and work like "div containers" in terms of size-none margin around itself? I also reckon that's why I do not see tables so often to be a method for laying out page design.

Thanks for whoever knows the answer.
Three answers:
2010-04-05 22:26:23 UTC
DIVs are not the total reason web designers who know their stuff do not use tables any more. Tables went out in the late 1990s when CSS became supported for making layouts. Web pages shouldn't be made with table tags unless you are presenting tabular data which tables were for originally.



Making table layouts with CSS is a step up, but really should be avoided as DIVs and CSS are the BEST way top control your site's look.



Tableless Web Design: http://en.wikipedia.org/wiki/Tableless_web_design

How to convert manually your HTML tables to CSS: http://www.table2css.com/articles/convert-your-html-tables-to-css

Images, Tables, and Mysterious Gaps: https://developer.mozilla.org/en/Images,_Tables,_and_Mysterious_Gaps



CSS Tutorials:



http://www.w3schools.com/Css/default.asp

http://www.csstutorial.net/

http://www.echoecho.com/css.htm

http://www.html.net/tutorials/css/

http://www.w3.org/Style/Examples/011/firstcss



Aside from setting the table borders to zero, you still have other stuff on the page NOT zeroed yet. Tables are actually parsed twice by browsers. Once for the real estate layout and then the content. Why waste that time when DIVs and CSS is so much better?



If you want to zero the "playing field" for everything before your CSS takes over, use the Universal Selectot at the VERY top of your CSS:



* { margin: 0; padding: 0; border: 0; }



IE is really bad about dimension calculations and has a lot of bugs which cause gaps where gaps shouldn't be:



Explorer Exposed: http://www.positioniseverything.net/explorer.html



Ron
BHC
2010-04-05 21:23:07 UTC
This will do want you want.







Border issues are not the motivation for avoiding table-based design. Tables used to be the only way to implement a page layout, and I must confess that I still commit this sin when I need to do something fast. The reason we are now taught to avoid tables is because the DIV approach is more flexible (allows things that would require many layers of nested tables), and allows you to separate content from layout. Its considered a "cleaner" coding technique.
?
2016-06-01 04:32:03 UTC
watch tutorials on youtube


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...