Search code examples
htmlblockinline

Is the following explanation/reason correct for distinction between inline and block-level elements in HTML


There is no align attribute with font tag because
It is an inline element. Use <center> instead.


Solution

  • The difference between a inline element and a block element:

    A block-level element is an element that creates large blocks of content like paragraphs or page divisions. They start new lines of text when you use them, and can contain other blocks as well as inline elements and text or data.

    An inline element is an element that define text or data in the document like STRONG makes the enclosed text strongly emphasized and Q says the enclosed text is a quotation. They don't start new lines when you use them, and they generally only contain other inline tags and text or data. Or they include nothing at all, like the BR tag.

    Source: http://webdesign.about.com/od/htmltags/qt/block_vs_inline_elements.htm

    By "parameters" I can only assume you mean how to define elements as inline or block-level. You could define, for example, a div tag using css or the following:

    <div style="display:inline">This is an inline div</div>
    <div style="display:block">This is a block-level div</div>
    

    As for an example of this type of content, you could format any essay or blog or anything with multiple paragraphs with these styles to show the difference.