Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vertical Wrapping in HTML

I'm looking for a good way to do a vertical wrap. My goal is to fit a list of checkboxes into a div. I have the checkboxes sorted alphabetically, and I want the list to flow from the top of the div to the bottom and then begin again in a new column when they reach the bottom. Right now, I can do this by breaking the list into chunks of a predefined size on the server-side before feeding it into my html template. But things get messy when the list gets so long that you have to scroll. I'm hoping to force it to scroll horizontally only. This is not so easy, since I'm holding each chunk in a floating div, so white-space:nowrap doesn't seem to cut it. Currently, I'm using javascript count the number of list chunks and extend the width of an intermediary container (inside the div that serves as the viewport but containing the divs that contain the data). I want something that looks roughly like this:

 __________________________
| []..... []..... [].....  |
| []..... []..... [].....  |
| []..... [].....          |
| []..... [].....          |
|__________________________|
|<|_____________|___||___|>|

So I guess I have two questions:

  1. Is there a good way to vertically wrap a list?
  2. Is there a good way to force horizontal scrolling when the data gets too large for the viewport?
like image 469
David Berger Avatar asked Jan 23 '09 22:01

David Berger


People also ask

How do I create a vertical section in HTML?

To make a vertical line, use border-left or border-right property. The height property is used to set the height of border (vertical line) element. Position property is used to set the position of vertical line. Example 1: It creates a vertical line using border-left, height and position property.

How do I wrap text to the next line in CSS?

FYI: You can use either the 'normal' or 'break-word' value with the word-wrap property. Normal means the text will extend the boundaries of the box. Break-word means the text will wrap to next line.

How do you wrap text in P tag?

HTML <pre> tag defines preformatted text. It is used to display code blocks since it preserves spaces and line breaks. If the line is large, then the <pre> tag won't wrap it by default. To wrap it, we need to use CSS.


1 Answers

I'd use CSS3 columns. However, only WebKit (Safari, Chrome, ...) and Gecko (Firefox, ...) have implemented it so far, and you'll have to add their respective vendor prefixes (-moz-column-width:...; -webkit-column-width:...;) for it to work.

If IE has to get columns, floated divs would probably be the best way.

like image 135
Ms2ger Avatar answered Oct 16 '22 05:10

Ms2ger