How should I use CSS declaration?
This way:
div#main_content {
width: 900px;
border: 1px solid #CCC;
margin: 20px 0 20px 0;
padding: 40px;
overflow: hidden;
}
or this way:
#main_content {
width: 900px;
border: 1px solid #CCC;
margin: 20px 0 20px 0;
padding: 40px;
overflow: hidden;
}
In sublime text 2, sublime linter package suggested me to use without the div – only #main_content, but on some tutorial I saw that it is better to use div#main_content as it is easier to parse.
What do you suggest I should use? (I think result will be the same in this case for the classes)
Better to just use the id. There should only be one element on the page with a given id, so the element type is redundant.
Another reason to miss off the element type is that if you decide to change your HTML (maybe changing the
<div>to something more semantic like a<p>or<section>) the CSS selector will still match.