search
HomeWeb Front-endHTML TutorialUsability comparison of div and table in websites

In page layout, div and table are often used, so what are their characteristics in the page? This article will talk about the usability comparison of div and table in the website. For those who are interested, continue below. Take a look.

DIV and TABLE do not have any advantages or disadvantages in themselves. The so-called web standards only recommend the correct use of tags. For example: DIV is used for layout, while TABLE is originally used to convert two-dimensional data. Letting TABLE do what it should do does not mean that TABLE is so awesome if it does not appear on the page.

The advantage of using DIV for typesetting is that I won’t say it, but everyone should be clear about it. DIV is a standard and a general trend, but it does not mean that all pages are suitable for use.

There is a big difference between Chinese portals and foreign portals. Chinese netizens don’t like pages with less information. When YAHOO arrives in China, the content on the page is much more. Last time, it was changed to a concise page. Later, the number of visits dropped so much that it was changed back within a few days. Officially, it is China’s national conditions that have created portals like Sohu and Sina.

Why DIV is not suitable for them? Let me explain one by one from several aspects:

Simplified code:

Everyone says that the layout of DIV is streamlined code, but the code saved by using DIV instead of TABLE is occupied by CSS (style), and most of these styles are used to control the layout of DIV. Then you will say that CSS can be reused externally. If you want to get the answer to this question, please read below.

Reusability and downloads:

Uniform use of a .css style sheet file can achieve the effect of modifying once and modifying the entire site, thus reducing maintenance costs lower. But please think about it from another perspective. If all pages have to access a file when loading, then the number of downloads of this file every day, especially on Sohu and Sina website platforms, will reach hundreds of millions. This will require a lot of information behind it. The front-end web server is providing support, and the cost of the backend has also increased a lot. If the background support is not done well, the page will appear blurred, and the previous work will be in vain. Many people will ask, the probability of this is too small. The work we do is to avoid these two accidents. If an accident occurs, the consequences for the portal will be disastrous.

HTTP communication:

The unified style sheet file adopts the form of external call, so that each time a single page is loaded, the http request to the server will be increased once. Response, this will consume a lot of money on the front-end web server. It turns out that for a long time, css and js were written on the front end of the page (you can look at the pages of sohu and sina, most of them use this form), rather than in the form of external calls, in order to try to avoid adding additional code to the server. consumption.

Page cache:

Every time a user visits a page, it will be saved in the browser cache for a certain period of time to ensure that the user can access the page next time. Improve page display speed. Each modification will cause the page to be re-downloaded, and the same is true for each externally imported style file. If the CSS file is modified, every page visited on the website will be re-downloaded. The previous method of writing styles on the page is just Modified pages need to be downloaded again.

Compatibility:

Not all versions of all browsers support CSS (style sheets) very well. For example, browsers before IE5 support CSS very well. The support is not very good. Nowadays, there are not a few users who use browsers before IE5. This means that during the page production process, different browser versions need to be tested to ensure compatibility, which also adds a lot of workload (at least to the developers I contact). The standard time to create a div page is longer than that of a table page).

Crosscutting and ductility:

Crosscutting - the traditional layout method divides the page into several blocks from top to bottom in order to make the page download faster. , but this situation often occurs in pages that use DIVs for layout. Since the number of content items in the middle column or other columns of each block is not fixed, the columns on both sides do not adapt at the same time, and blank spaces appear.

In contrast, the traditional table method is easier to avoid such situations.

Above we only discussed the availability of a certain technology in a certain field, not the technology itself.

Having said all this is not to say that the layout method of DIV is not good, but that we should correctly view the role of Table in a large content-based portal, rather than following what others say. The reason why the DIV layout method is not used in large websites does not mean that the portal does not use DIV because the technology is backward, but because the people inside are not forward-looking, but it is determined by various reasons. The reason why NetEase all uses DIV is because content is not their main focus. For other portals, such decisions will depend on time to verify. It's just that the time is not yet ripe now. ?

The above is the detailed content of Usability comparison of div and table in websites. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
css怎么实现div缺一个角css怎么实现div缺一个角Jan 30, 2023 am 09:23 AM

css实现div缺一个角的方法:1、创建一个HTML示例文件,并定义一个div;2、给div设置宽高背景色;3、给需要删除一角的div增加一个伪类,将伪类设置成跟背景色一样的颜色,然后旋转45度,再定位到需要去除的那个角即可。

基于 ChatGPT API 的划词翻译浏览器脚本实现基于 ChatGPT API 的划词翻译浏览器脚本实现May 01, 2023 pm 03:28 PM

前言最近GitHub上有个基于ChatGPTAPI的浏览器脚本,openai-translator,短时间内star冲到了12k,功能上除了支持翻译外,还支持润色和总结功能,除了浏览器插件外,还使用了tauri打包了一个桌面客户端,那抛开tauri是使用rust部分,那浏览器部分实现还是比较简单的,今天我们就来手动实现一下。openAI提供的接口比如我们可以复制以下代码,在浏览器控制台中发起请求,就可以完成翻译//示例constOPENAI_API_KEY="s

div与span的区别有哪些div与span的区别有哪些Nov 02, 2023 pm 02:29 PM

区别有:1、div是一个块级元素,span是一个行内元素;2、div会自动占据一行,span则不会自动换行;3、div用于包裹比较大的结构和布局,span用于包裹文本或者其他行内元素;4、div可以包含其他块级元素和行内元素,span可以包含其他行内元素。

div盒模型是什么div盒模型是什么Oct 09, 2023 pm 05:15 PM

div盒模型是一种用于网页布局的模型,它将网页中的元素视为一个个矩形的盒子,这个模型包含了四个部分:内容区域、内边距、边框和外边距。div盒模型的好处是可以方便地控制网页布局和元素之间的间距,通过调整内容区域、内边距、边框和外边距的大小,可以实现各种不同的布局效果,盒模型也提供了一些属性和方法,可以通过CSS和JavaScript来动态地改变盒子的样式和行为。

iframe和div有什么不同iframe和div有什么不同Aug 28, 2023 am 11:46 AM

iframe和div的不同是iframe主要用于引入外部内容,可以加载其他网站的内容或将一个网页分割成多个区域,每个区域有自己的独立的浏览上下文,而div主要用于分割和组织内容的区块,用于布局和样式控制。

如何将两个div并排显示如何将两个div并排显示Nov 01, 2023 am 11:36 AM

方法有:1、将两个div元素设置为“float:left;”属性;2、使用CSS的flex布局可以轻松实现元素的并排显示;3、使用CSS的grid布局也可以实现元素的并排显示。

css div内容超出隐藏怎么实现css div内容超出隐藏怎么实现Jan 28, 2023 pm 03:12 PM

css div内容超出隐藏的实现方法:1、通过css代码“overflow: hidden;”实现内容超出隐藏;2、通过js代码“var myBox = document.getElementById('demo');var mydemoHtml = myBox.innerHTML.slice(0, 20) +'......';”实现内容超出隐藏即可。

如何在css中让div居中如何在css中让div居中Oct 12, 2023 am 10:07 AM

在css中让div居中的方法有使用margin属性、flexbox布局、绝对定位和使用grid布局等。详细介绍:1、使用margin属性,最简单的方法是使用margin属性,通过设置左右margin为auto,可以将div水平居中;2、使用flexbox布局,Flexbox是CSS3中引入的一种弹性盒子布局模型,可以方便地实现元素的居中;3、使用绝对定位,通过使用绝对定位等等。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools