SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Text content in <DIV>s and <TD>s

    Hi,
    I've been handing out as much advice as I can to people on here but there's one thing I've corrected quite a few people on which I'm wondering whether I was possibly incorrect on as it seems to be very prevalent.

    If you have some text which you want to place somewhere on a page, not necessarily a paragraph, not really a header either, but some sort of content, may be a snippet of information, directions or whatever.

    Is it appropriate to place this inside <DIV> or <TD> tags instead of <P> or <H4> etc. It seems to me that any text should be in a <P>, <H1>, <H2> etc. rather than just floating there inside a containing box. It seems to me that a <TD> would only be appropriate if it's tabular data, but a <DIV> is really for anything that doesn't fit the mould of another tag AFAIK. But does text which isn't quite a paragraph suit going directly into a <DIV> or not?

    Hopefully someone can clear up the confusion for me!

    Thanks,
    Ryan

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It makes sense (to me, at least) for all children of an element to be of the same type: either only block-level or only inline-level. A mix of both seems like apples and oranges and it doesn't make semantical sense.

    There's nothing wrong, necessarily, with having a text node as an immediate child of a DIV, if there are no block-level siblings. Sometimes you have some text that isn't quite a paragraph.
    Birnam wood is come to Dunsinane


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •