Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Creating multi-column text

From: CSS: Page Layouts

Video: Creating multi-column text

In this chapter, we're going to focus on ways that you can enhance your page design through creative styling. I want to start by talking about creating multi-column text. In the past we've had to use some fairly restrictive techniques like floating to achieve multiple columns of text, but recent improvements in CSS have made it fairly simple to modify your text blocks. So I have the multiple-column.htm file from the 08_01 folder opened up, and I'm just going to preview this page for you really quickly to kind of show you what's going on here. We have a little bit of descriptive text, and then we have some body copy right down here that I want to place into multiple columns.

Creating multi-column text

In this chapter, we're going to focus on ways that you can enhance your page design through creative styling. I want to start by talking about creating multi-column text. In the past we've had to use some fairly restrictive techniques like floating to achieve multiple columns of text, but recent improvements in CSS have made it fairly simple to modify your text blocks. So I have the multiple-column.htm file from the 08_01 folder opened up, and I'm just going to preview this page for you really quickly to kind of show you what's going on here. We have a little bit of descriptive text, and then we have some body copy right down here that I want to place into multiple columns.

So I'm going to go back into my code, and if I look at the structure of the page, so I know who to target, I can see that the text that I want to target is in a section, and actually that's the only section that we have in the HTML code, so it makes a very quick and easy way to target it. Now, for our first example I am just going to do two of the available properties that we have to control multiple columns. I'm going to do column-count, and I'm going to make the column-count 2. Then I'm going to do column-gap, and I'm going to put the gap at 16 pixels.

So you can probably figure this out, that column-count basically says, okay, how many columns do I want to split this element into, and then the gap describes the amount of space between the columns. So if I save this and go back in my browser and preview it, you can see that now we have multiple columns of text, two columns, and there's 16 pixels' worth of space between them. All right! So other properties that you can control, we have column-width, column-count that we just used, column-gap, and column-rule. There are a few more, but those are really the main ones.

And some of these properties, like column-rule, have more then one property that govern them, but you can use shorthand notation to take care of them all at once if you want. Now, here's the bad news about dealing with multiple columns. Now, you'll notice I am in Opera right now. I'm going to switch over to the Firefox and test my page. Now, I'm going to switch over to Chrome and test my page. No multiple columns. You know, this is one of those instances where support for this is not universal among browsers, but there are ways where we can ask Chrome, Safari, and Firefox to support this property, and that's through the use of something called a vendor prefix.

So I am going to go back into my code and I am just going to take the properties that we wrote here for column-count, I'm going to copy those, and then I'm going to paste them twice. Now, I'm going to go up to the first set and I'm going to add a vendor prefix to that. I am going to add -moz-, and I'll do the same thing to column-gap, -moz-, no spaces there at all. And then right below that I'll do -webkit. WebKit of course is going to cover more than just one browser. That will be Chrome and Safari and any other WebKit-based browser.

I am going to go ahead and save this. Now, what are those? If you haven't seen those before, those are vendor prefixes, and essentially for newer CSS properties that browsers are just adopting, most browsers, including Opera, they will place a vendor prefix in front of the property. Now, what that does is it allows the browser manufacturer to sort of experiment and standardize the way that they support that property, while still allowing designers to utilize it. So when you use something that needs a vendor prefix, you need to go into that with your eyes open and realize that this is an implementation that is still being worked on, so it may not be stable over the course of that particular site.

So it's one of those things that's like, okay, I am going to use this to enhance my page, but I am not going to use it for something that's mission-critical. All right! So if I save this and I go back into Firefox and I refresh, now I get my multiple columns. And in Chrome I get my multiple columns as well. Cool! Now, I want to go back into my code really briefly here and talk about some of the other properties. In particular I want to focus on column-width. So I am going to go right down into section, and I'm just going to do column-width of 22 pixels.

Now, column-width does not do what you might think it does. Yes, it does control the width of the column, but it does not let you specify one column, for example, being wider than another. What happens is the columns are split up equally. So the two properties, column-count and column-width, are very closely tied together. If I save this and I go into Opera and I refresh this, our section is now split into 22 columns, which, while not readable, I find that strangely beautiful. All right! If I go back into my file and I change that to say 120 pixels and test it, you can kind of see what's happening here with the behavior.

Essentially it's saying, okay, of the available space that I have, I have 120 pixels for the column width so I am going to create as many as I can at that width. So what this tells you is that if you use column-width, it's essentially going to overwrite column-count. Column-counts says, hey, within the available space, give me two columns or three columns, and then the browser will calculate those widths for you. It will just automatically figure out those widths. But if you explicitly say, I want columns that are 120 pixels wide, then regardless of what your column-count is, that is what you are going to get.

I am going to go back into my code, and I am going to get rid of column-width, because we don't need that, and I will just go ahead and save that. Okay. So creating multi-column text, I think you can see that that is a really useful ability to have in CSS, but there are a couple of things that you need to keep in mind. Unfortunately, the current state of support means that we still have to treat it as a means of enhancing our designs and not as something that we are going to place into a really, really critical part of our layout, where it would fail if we didn't get our multiple columns. Now, thankfully, support for it has been announced for Internet Explorer 10, and the standardization of support in Firefox and WebKit will mean that we can drop those prefixes fairly soon for those browsers as well.

The other thing that you need to consider too is that when you do this to an element in the page, everything within that element, and I mean everything, is split into those columns, so headlines, images, anything else. So if you have sections of text that you want in multiple columns, but you don't want other content within that element to go into multiple columns, often you're going to have to go back into your code and wrap the text that you want in multicolumn text within a div tag or another section or something of that nature. Images that are too wide to fit in a column will be cropped off.

So those are all things that you need to consider before you start using multiple-column text, but I encourage you to go and experiment with it, because it is definitely something that can help you enhance your page design.

Show transcript

This video is part of

Image for CSS: Page Layouts
CSS: Page Layouts

71 video lessons · 44019 viewers

James Williamson
Author

 
Expand all | Collapse all
  1. 4m 20s
    1. Welcome
      54s
    2. How to use the exercise files
      3m 26s
  2. 1h 39m
    1. Box model review
      8m 47s
    2. Calculating element dimensions
      11m 11s
    3. Understanding margin collapse
      7m 59s
    4. Calculating em values
      7m 41s
    5. Calculating percentage values
      7m 51s
    6. Normal document flow
      13m 3s
    7. Controlling element display
      8m 53s
    8. Using CSS Resets
      7m 11s
    9. Fixed, fluid, and responsive layouts
      9m 9s
    10. CSS debugging tools
      6m 46s
    11. Using the Firebug Inspector and the WebKit Web Inspector
      11m 5s
  3. 53m 15s
    1. Page design workflow
      3m 6s
    2. Page design tools
      4m 56s
    3. Determining page structure
      7m 18s
    4. Creating image assets
      8m 58s
    5. Creating initial page structure
      7m 3s
    6. Adding meaning with classes and IDs
      5m 23s
    7. Structuring content with HTML5
      6m 6s
    8. Building internal structure
      10m 25s
  4. 1h 36m
    1. Floating elements
      7m 50s
    2. Clearing floats
      7m 28s
    3. Containing floats
      7m 50s
    4. Clearfix technique
      10m 38s
    5. Floating inline elements
      14m 34s
    6. Two-column floated layouts
      8m 17s
    7. Three-column floated layouts
      11m 30s
    8. Column height considerations
      7m 3s
    9. Creating equal-height columns
      10m 42s
    10. Floats: Lab
      5m 25s
    11. Floats: Solution
      5m 21s
  5. 51m 42s
    1. Relative positioning
      7m 59s
    2. Absolute positioning
      8m 59s
    3. Fixed positioning
      4m 23s
    4. Controlling stacking order
      8m 31s
    5. Clipping content
      8m 21s
    6. Controlling content overflow
      5m 38s
    7. Positioning elements: Lab
      3m 59s
    8. Positioning elements: Solution
      3m 52s
  6. 48m 46s
    1. Design considerations for fixed layouts
      3m 28s
    2. Establishing the layout grid
      7m 57s
    3. Defining column spacing
      9m 30s
    4. Applying the grid through CSS
      8m 56s
    5. Creating grid-based assets
      8m 26s
    6. Grid design resources
      6m 22s
    7. Building fixed layouts: Lab
      4m 7s
  7. 44m 35s
    1. Designing for flexible layouts
      2m 30s
    2. Calculating percentage values
      8m 45s
    3. Setting flexible width values
      6m 6s
    4. Making images flexible
      8m 10s
    5. Setting minimum and maximum widths
      7m 24s
    6. Building flexible layouts: Lab
      4m 53s
    7. Building flexible layouts: Solution
      6m 47s
  8. 49m 36s
    1. Responsive layout overview
      3m 49s
    2. Using media queries
      7m 16s
    3. Organizing styles
      8m 39s
    4. Making content responsive
      8m 33s
    5. Mobile design considerations
      7m 32s
    6. Building responsive layouts: Lab
      4m 23s
    7. Building responsive layouts: Solution
      9m 24s
  9. 1h 22m
    1. Creating multi-column text
      6m 36s
    2. Using borders to enhance design
      13m 59s
    3. Rounding corners
      6m 56s
    4. Adding drop shadows
      10m 35s
    5. Working with opacity
      6m 8s
    6. Utilizing the background property
      15m 5s
    7. Working with CSS sprites
      7m 58s
    8. Enhancing page design: Lab
      6m 22s
    9. Enhancing page design: Solution
      8m 38s
  10. 6m 25s
    1. Additional resources
      6m 25s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed CSS: Page Layouts.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.