4
Use the names of tags HTML5 as most CSS selectors is a good practice? Be it because I’m not creative to give names to ids
or classes, or by wanting to make HTML code as clean as possible, leaving only the structure and semantics of tags.
Since my apprenticeship, I have always used and abused tags because of its semantics, for example in the place of a <div id="cabecalho">
use only one <header>
and things like that (<footer>, <main>, <section>, <aside>
and so on...).
In some forums and posts on name sites (Caelum), I read something that implied that practicing this makes your CSS less versatile and with great chances of its early maintenance, as it is totally stuck to the HTML structure.
I always have to use classes and ids
, always choose to tags where possible or if there is a middle ground?
""name sites" in this case do not know if it is a good thing, mainly because it seems to me that your reasoning is being sensible, and the site at least doubtful (now, it may be that they have said something else and have been misunderstood, just reading the same original). Obviously if you have one
<header>
it is unnecessary to create a#cabecalho
no reason. Go for the simplest, shortest, and most objective. Only complicate if you need to. Almost always you will be able to get the site in order with few classes and Ids. Usually who fills with random identification on everything that is tag does not dominate the subject.– Bacco
ah yes, here is the link (http://blog.caelum.com.br/seu-codigo-css-pode-ser-mais-limpo-flexivel-e-reusable/) of a read see what you think, but this is the idea, be the simplest, so I was wise.
– Lucas Henrique
I’ve wondered the first phrase "Good programmers learn good code practices since they were little children". I’m not going to say good or bad about the site here, just for ethical reasons, but I think people get a lot of cake recipes when they should explain the real reasons for doing it that way or that. And most important: there is no solution that fits all cases, so the important thing is to understand (as you did, asking to know more) than to buy ready-made ideas from others that we do not know for sure who they are.
– Bacco