+ 1
<article> or <div>?
hey Im confused... when to use <article> and when to use <div>? ain't it close to the same?
6 Réponses
+ 2
<article> and several other new tags of html5 like <header>, <footer>, <aside>, <section>, etc. are meant to indicate what the block contains and/or where it is positioned on the page. <article> defines an article in the document (a blog post, a forum post, etc.).
<div> is a more general purpose tag to contain a block of code. In html4, you often had things like <div class="header">, <div class="footer">, etc. with some associated css, and they were given their own tag in html5 to simplify things.
+ 1
Using <article> instead of <div class="article"> doesn't change much the css you have to write. However, adding a class to elements you want to select (that are not <article>, <header>, etc.) does, and I would recommend to do so. In general, put a class indicating the purpose of the element, because you generally want the same style applied to all of those elements.
0
làm sao
0
thanks zen! does that mean that <div> should be used to make work with css easier?
0
When using any HTML5 tags for layouting you may have some limitations! Consider using DIV and you will have no problems.
0
thanks guys!