Z
Z
za_lupina2022-03-20 13:00:47
HTML
za_lupina, 2022-03-20 13:00:47

What is better than a table or a div?

What's the best way to type with tables or divs?
I read that they don’t make up tables anymore, is that so?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Nesterov, 2022-03-20
@AlexNest

Yes, for ten years now.
They are laid out with block elements (not only divs, but also others, such as header, footer, article, etc.), to which the following styles are applied (optional):

  • flex
  • grid

In general, with each of them you can achieve the same thing , but in different ways.
"Which one to use?" Try both options, and in general, use what will come in more, and when you need another (for technical reasons or when finalizing an existing one), just switch temporarily to it.

M
Maxim Benets, 2022-03-21
@teaCode

Tables are no longer used.
Block layout is lighter, adaptive and allows you to do more than tables)

A
Ankhena, 2022-03-21
@Ankhena

What is better than a table or a div?

None of them are better or worse. Everything is as usual: each of them has its own purpose.
Tables
With the help of a tag <table>, tabular data is typeset.
At the same time, no one bothers to change their display and rebuild as you please.
There are problems that can't really be solved with table, but rarely.
div
An element that has no semantic meaning.
It is recommended to use it when there are no other tags that are suitable in meaning.
(This is written directly in the specification https://html.spec.whatwg.org/multipage/grouping-co... )
Therefore, when layout, elements (semantics) that are suitable in meaning are used .
Those. if you need to make up a list, then it is made up usingulor ol, sections are tagged with <section>, not <div>. Etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question