表格和基于CSS的网页布局 [英] Table vs CSS-based layouts for web pages

查看:131
本文介绍了表格和基于CSS的网页布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用HTML模板为我的网站从销售模板的网站,因为我不是一个设计师,并希望准备好,我使用Rails的我的发展。我注意到一些网站使用CSS和组件在页面中的绝对定位将其模板设计为无表。我实际上习惯在我的网页中使用表格。

I use HTML templates for my website from sites that sell templates as I'm not a designer and would like something ready, I use Rails for my development. I noticed that some sites design their templates as "Tableless" by using CSS and absolute positioning of components in the page. I'm actually used to using tables in my pages.

你对此有何看法?

推荐答案

简单的答案是,你应该使用表格数据(而不是布局,请参阅这里为什么),否则您使用正确的元素用于正确的用途, p 用于段落, div 用于有意义的划分(do not abuse divs)等。每个元素都是为了实现目的,您应该使用 w3.org

The short answer is that you should use tables for tabular data ( and not layout, see here why ), otherwise you use the right element for the right purpose, p for paragraphs, div for meaningful division ( don't abuse divs ), et cetera. Each element serves a purpose and you should use w3.org to look things up.

话虽如此,有些人在CSS中仍然有错误的心态,你应该避免完全依赖于绝对定位和像素的布局完美的滥用,而是依靠流动的,基于电子的布局,当你可以因为这些更适应不同的屏幕分辨率和环境。

That being said, there are some people who still have the wrong frame of mind in CSS, you should avoid layouts that are completely reliant upon absolute positioning and pixel perfect abuse, instead rely on fluid, em-based layouts when you can as these are more adaptable to different screen resolutions and environments.

使用正确的语义标记的其他好处HTML和CSS将是你从样式表中控制所有样式,所以结果更少的标签汤代码(更小的文件大小),你只需要担心更新内容,而不是布局里面的标记[css )from behavior(js)and content(html)]。

Other benefits of using proper semantically marked up HTML and CSS would be that you control all styles from the style-sheet, so that results in less tag soup code ( smaller file size ) and you only have to worry about updating content, not layout inside the markup [ separation of presentation ( css ) from behavior ( js ) and content ( html ) ].

这篇关于表格和基于CSS的网页布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆