O'Reilly logo

Learning PHP, MySQL, JavaScript, and CSS, 2nd Edition by Robin Nixon

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Multicolumn Layout

Multiple columns has long been one of the features most requested by web developers, and this has finally been realized in CSS3, with Internet Explorer 10 being the last major browser to adopt it.

Now, flowing text over multiple columns is as easy as specifying the number of columns and then (optionally) choosing the spacing between them and the type of dividing line (if any), as shown in Figure 19-5 (created using the code in Example 19-3).

Flowing text in multiple columns
Figure 19-5. Flowing text in multiple columns
Example 19-3. Using CSS to create multiple columns
<!DOCTYPE html> <html> <head> <title>Multiple Columns</title> <style> .columns { text-align :justify; font-size :16pt; -moz-column-count :3; -moz-column-gap :1em; -moz-column-rule :1px solid black; -webkit-column-count:3; -webkit-column-gap :1em; -webkit-column-rule :1px solid black; column-count :3; column-gap :1em; column-rule :1px solid black; } </style> </head> <body> <div class='columns'> Now is the winter of our discontent Made glorious summer by this sun of York; And all the clouds that lour'd upon our house In the deep bosom of the ocean buried. Now are our brows bound with victorious wreaths; Our bruised arms hung up for monuments; Our stern alarums changed to merry meetings, Our dreadful marches to delightful measures. Grim-visaged war hath smooth'd his wrinkled front; And now, instead of mounting barded steeds To fright the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required