Search code examples
csslayoutstackpanel

Can you make a Stack Panel type layout using CSS?


I've had immense trouble googling this, I guess I don't quite know the name for the concept. I have a section of the page where a series of text boxes will appear, the number might vary. I'd like to have them fill a div in a top-to-bottom then left-to-right manner. That is, the text boxes will stack (normal) until they reach the bottom then wrap around to the top again in a new column.

Like:

Textbox1    Textbox4    Textbox7
Textbox2    Textbox5    Textbox8
Textbox3    Textbox6

Is that possible in CSS, or will I need to actually code something to do this correctly?


Solution

  • You can use CSS columns, which is described on A List Apart.

    Note that this only works in modern browsers. Otherwise you need JavaScript or extra HTML.