• 0

div tags


Question

i have a question about div layers. im trying to get rid of a table layout by using div tags. i hit a problem when it comes to size. in tables, the default will resize the table to the content (creates a snug fit with no wrapping). when i used div tags, the default always is a width of 100%. is there some attribute that creates that snug fit? right, now i have used a container div layer with an absolute width that is smaller than the content, but i would rather do it properly.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

I'm not quite sure i understand what you're trying to do, but to explain, a div tag is a block level element... meaning it is rendered as a block, ie. 100% of containing block width. If you want it to have a fluid width, you can either use a span tag instead, which is an inline element by default, or you can use a div and set the "display" style of the div to "inline".

I hope that helps. Btw, if you're trying to replace a table layout, I recommend using a div with relative or absolute width... depending on whether you want a fluid layout or a static one.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.