Tuesday, April 13, 2004

Some HTML basics

I stumbled across this in the Webmasterworld Forums. Sometimes I really appreciate when the basics are revisited. I think that with this question, the posters there were addressing a question that everyone that learns HTML has at one time or another. Read on...

"SuzyUK once gave a wonderful explanation, where, if I recall correctly, she likened div's to shelves in a supermarket and span's to boxes on the shelves.
Thus div's may contain other div's and div's may contain's. But span's may not contain div's.
Until that explanation I never properly understood what 'inline' was supposed to mean. "

"The div tag is a block-level element (defaults to display: block) and can include block-level and inline elements
the span tag is an inline element (defaults to display: inline) and can only include inline elements
see www.htmlhelp.com "

The poster was here referring to HTML-speak with "display:block" etc... In CSS, there is the attribute "display" and there are, I think, 4 options of how the tag can be forced to show itself if you put in the "display:block" etc... attributes. You can even put in a "display:none" and you get nothing. This can be nifty for making something appear on mouseover etc...