When to use div’s and when not to
A common question in #web on Freenode IRC, goes something like this:
“Should I use
The answer is, neither.
What most people call “using
You should also never use a
Using the following CSS, the following two HTML examples display the same:
- #header {
- color: red;
- background-color: grey;
- font-size: 32px;
- }
- <div id=“header“>
- Welcome to my site!
- div>
- <h1 id=“header“>
- Welcome to my site!
- h1>
So why – you ask – does it matter which I use? Well, just looking at the two examples, the second one obviously denotes the text a 1st level header. The top one doesn’t give any information about the text contained in it.
This doesn’t mean you should never use a
and has a different style).
I know I haven’t gone into much depth here, but thats the long and short of it as I see it. I hope that helps someone.
- Davey
@dshafik Anytime tools are released that give just anyone the ability to do something without coding, programmers see a pay cut in contracts
@fasterkitty [3 hours ago]
@fasterkitty I think that depends on the quality of the apps the Flash folks put out...
@dshafik [3 hours ago]
@fasterkitty from what I hear, they are already culling apps that violate the Desktop/Widget rule. For example: http://bit.ly/cb3l0B
@dshafik [3 hours ago]
Looking for a design, thinking of using 99designs; unless someone I know wants to do some work for me? (for pay!)
@dshafik [3 hours ago]
@dshafik can you please call our support, so that we could help you with those issues?
@EyeFiCard [7 hours ago]
















