The specification for the article
element says:
The
article
element represents a component of a page that consists of a self-contained composition in a document, page, application, or site and that is intended to be independently distributable or reusable, e.g. in syndication. This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content.
So, if I'm building a website where, in its home page, I have cards that are clickable and leads you to the article page, would be better - in semantic - if this card would be a section
or an article
element?
The <div> element is often used as a container for other HTML elements. The <div> element has no required attributes, but style , class and id are common.
The <div> tag is a generic container that defines a section in your HTML document. A <div> element is used to group sections of HTML elements together and format them with CSS.
A card is a flexible and extensible content container. It includes options for headers and footers, a wide variety of content, contextual background colors, and powerful display options.
It can be appropriate to use the article
element for post teasers. It depends on what content you show. For example:
article
element.article
element wouldn’t be warranted, because each teaser would become an entry in the document outline (as article
is a sectioning content element), but there isn’t much point for an outline entry if it doesn’t contain any additional content.If you decide to use article
(and only then!), you can use the bookmark
link type for the link to the full article page. This can be a hint that your article
isn’t the "full thing".
If you decide not to use article
, don’t use section
. If choosing between article
and section
, article
is the correct choice for a teaser. But if article
isn’t appropriate, you shouldn’t use another sectioning content element, but something like p
and/or ul
(and no heading elements).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With