Jump to content

Corrrect usage with <table> <list> and <p>


nomnex

Recommended Posts

What is the correct usage?Do I need to enclose lists and tables in paragraph tags, or is it a mistake doing so?

<p>some text</p><p><table></tabe></p><p>some text</p><p><li></li></p>
Thanks
Link to comment
Share on other sites

Lists and tables are block level elements, and as such it's not necessary or advised to wrap them in paragraph tags. You can give them the same basic styling (width, float, etc) as any surrounding paragraphs to make them behave similarly without the need for unsemantic tags.

Link to comment
Share on other sites

One more thing, what is the correct way to separate 2 contiguous tables or lists? to use a <br /> tag?Edit: or to add some empty space between a <p> and a <table>?+ How do I know when a HTML topic I study relates to a block level elements or not? Is there a list of block elements?

Link to comment
Share on other sites

One more thing, what is the correct way to separate 2 contiguous tables or lists? to use a <br /> tag?
You shouldn't need to use anything to separate them - if you want more space, using margins (in CSS).
+ How do I know when a HTML topic I study relates to a block level elements or not? Is there a list of block elements?
Block elements are simply those that force future content below them.
Link to comment
Share on other sites

+ How do I know when a HTML topic I study relates to a block level elements or not? Is there a list of block elements?
This is what I found when I did a google search.List of defined block-level elements in HTML 4:Most HTML 4 elements permitted within the BODY are classified as either block-level elements or inline elements. Block-level elements typically contain inline elements and other block-level elements. When rendered visually, block-level elements usually begin on a new line.http://htmlhelp.com/reference/html40/block.htmldink
Link to comment
Share on other sites

You shouldn't need to use anything to separate them - if you want more space, using margins (in CSS).
I have specified in the topic's title" HTML Basic Tutorial (W3S)". That's what I am doing now. I guess my option to separate the HTML table examples in my workbook is <br /> instead of <p>, until I reach the CSS tutorial.
Block elements are simply those that force future content below them.
I see, so table and lists. <img> however is not a block elements, is that correct?
Link to comment
Share on other sites

<img> is not a block-level element. Note that if you are just learning about HTML, you shouldn't really worry about how your pages actually look, because you can fix all that once you get to CSS.

Link to comment
Share on other sites

<img> is not a block-level element. Note that if you are just learning about HTML, you shouldn't really worry about how your pages actually look, because you can fix all that once you get to CSS.
It sure will. It's premature to have "my pages". I just reproduce the examples on the tutorial and some elements stack to each other (e.g. the tables), I used to space them using <p></p>, I know now that's not proper. So <br /> should fit the bill until I reach the CSS tutorial. Thanks for your concern anyway.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...