Say I have a div. If I give it a height and width of 500*500px in HTML code, like this: <div width="500px" height="500px">test</div> it will not have dimensions of 500*500px unless it’s filled with enough code/text to push it to those dimensions. However, if I set the exact same width and height with CSS (either inline CSS or external document) like this: <div style="width:500px; height:500px;">test</div> the dimensions are always what I set.
Why is there a difference?
Doing this isn’t valid syntax. You cant add width & height attributes to a DIV the same as you can to a table or an image tag.
This is valid syntax: