+ 3

Which is more preferable in HTML? <table> or <div> ?

30th Jul 2020, 4:49 PM
The Death Reminder
The Death Reminder - avatar
6 odpowiedzi
+ 3
<table> and <div> have completely separate purposes. <table> creates a table to store schedules, or other things that involve cells. <div> divides parts of a document into sections. The two tags can't do each other's jobs well.
30th Jul 2020, 4:55 PM
PresidentOfYes12
PresidentOfYes12 - avatar
+ 3
Table is used to create a table, div is used to group block elements together, so then you can use CSS on all of them together, for example, you could put ten paragraphs between <div id="red"> and </div> and then write #red {color: red;} to make all paragraphs red.
30th Jul 2020, 4:56 PM
Karak10
Karak10 - avatar
+ 3
The Death Reminder I use <div> more, so I guess that would be the element that's better, but they aren't better in terms of their usage, because they serve different purposes. If they serve the same purpose, then you could rate them by yourself
30th Jul 2020, 5:01 PM
PresidentOfYes12
PresidentOfYes12 - avatar
+ 3
You could use div to make a fake table by using CSS, but its better not to, because real table can allow users to print it, or even scroll on it, there are elements like thead, tbody and tfooter that can be used unside table too, which are useful if the table is really large, because when someone wants to print it he will have to print it on multiple pages, and the header and footer will be on top and bottom of all pages, or if you make the table scrollable you can make it so the header and footer won't be effected while scrolling.
30th Jul 2020, 5:01 PM
Karak10
Karak10 - avatar
+ 2
🌀PresidentOfYes12🌀 Karak10 between them which is better (on a general scale)?
30th Jul 2020, 4:57 PM
The Death Reminder
The Death Reminder - avatar
+ 1
<div> seems a bit execptional type.
30th Jul 2020, 5:02 PM
The Death Reminder
The Death Reminder - avatar