Using table or div
This question already has an answer here:
It depends entirely on what you're wanting to display :
<DIV>
and <SPAN>
is for page layout <Table>
is for displaying tabular data (such as data points etc) The days of using <table>
for whole page layouts is gone - and you should be discouraged for using them for this reason.
HTML tags are meant to be semantic. This means describing the data it contains - not how to display it (this is for stylesheets to handle)
There's nothing fundamentally wrong with TABLE - it's just that it was historically overused for the wrong thing. In general, try to use TABLE for true tables of data, use DIV and SPAN for logical block or inline containers of content.
Tables should only be used to display data in a tabular way. For layout and design it is best practise to use divs and stylesheets.
Controlling the divs using stylesheets can take a while if you're not used to it, but it's quite easy to pick up.
You'll be thankful you did it later when the client wants the whole site redesigned and it means you don't have to undo the entire page in order to make the required changes.
链接地址: http://www.djcxy.com/p/15488.html上一篇: 使用表格作为布局
下一篇: 使用表格或div