The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS table vs div

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #43723

    I know table is a bit outdated but each time use div there alignment issue. Any tips? Coz tried ‘text align:middle’ & ‘left margin/right margin:auto’ but still not playing nice with me.

    [website]( “website”)


    I suggest you got to and make a use case of the troubles you are having. Once you run into a problem save the pen and post it back here so we can see exactly what kinda of problems you are having. Golden rule, divs are block elements that play nice with margins and position relative :)


    There really is no “table vs div”. It is better to think about elements as a flow. So you get separation to:

    – Inline elements: the things that follow the flow line by line.
    – Block elements: the things that steal the entire “line” to themselves.
    – Inline-block elements: the things that act as if they’re a single character on a line, but are otherwise treated like a block element.
    – Table elements: the things that steal the entire “line” to themselves, but otherwise act kinda like they’re inline-block elements (no 100% width by default). And of course cells have their own special set of rules.

    Then you have to remember these exceptions:

    – Floated elements are not in the flow, but flow elements avoid floated space.
    – Absolute and fixed elements are not in the flow. And also ignore floats.

    Using floats to create layouts is a hack just like tables are, floats just allow for much cleaner HTML and better semantics despite not being the perfect solution. Flexbox and grids are coming in the future and those will make layouts less hacky in nature. In any case you want to learn how elements flow on the page, as that will also explain why `margin: 0 auto;` works in some cases and why it doesn’t work in others.


    Thanks John & Merri for both your comment & advise. Finally it works!

    [under codepen]( “”)

    Now how do I make the bullets closer/tighter in the middle without making rest haywire coz the rslide in at 1227px

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.