New Feature: Playlist Center! Pick a topic and let our playlists guide the way.

Start learning with our library of video tutorials taught by experts. Get started

Illustrator for Web Design
Illustration by

Simulating the CSS box model


From:

Illustrator for Web Design

with Justin Seeley

Video: Simulating the CSS box model

Regardless of whether or not you are adept at writing your own CSS and HTML, it is very important for you as a web designer to understand how both of those technologies work, especially when it comes to CSS. And so in this movie we're going to be exploring something called the CSS box model and how you can simulate that inside of Adobe Illustrator. And so here on my screen I have a little mockup of the CSS box model, and so basically what we're seeing here is how objects are interpreted on the web as CSS.
Expand all | Collapse all
  1. 1m 13s
    1. Welcome
      50s
    2. Using the exercise files
      23s
  2. 43m 51s
    1. Designing for screens
      1m 57s
    2. Decoding screen size and resolution
      2m 40s
    3. Exploring the Illustrator to HTML workflow
      3m 42s
    4. Setting up Illustrator for web work
      6m 55s
    5. Creating a new document for web
      6m 25s
    6. Creating a new document for mobile
      3m 31s
    7. Using artboards for responsive layouts
      7m 42s
    8. Creating email newsletter documents
      4m 31s
    9. Working with Pixel Preview and anti-aliasing
      6m 28s
  3. 25m 28s
    1. Adjusting color settings
      6m 47s
    2. Understanding web color
      3m 47s
    3. Creating a color palette
      5m 4s
    4. Creating custom swatches
      4m 50s
    5. Working with fills and strokes
      5m 0s
  4. 13m 15s
    1. Exploring the Layers panel
      5m 21s
    2. Renaming and grouping layers
      7m 54s
  5. 24m 5s
    1. Drawing simple shapes
      4m 16s
    2. Working with Pathfinder
      5m 4s
    3. Using the Shape Builder tool
      4m 33s
    4. Creating symbols
      6m 24s
    5. Editing and replacing symbols
      3m 48s
  6. 20m 22s
    1. Planning your project
      2m 56s
    2. Using guides and rulers
      5m 56s
    3. Developing a layout with shapes
      6m 21s
    4. Using a grid system
      5m 9s
  7. 25m 53s
    1. Exploring the rules of typography
      4m 1s
    2. Using text as text vs. using text as an image
      3m 37s
    3. Understanding web-safe fonts
      1m 46s
    4. Creating and using paragraph styles
      5m 16s
    5. Creating and using character styles
      3m 2s
    6. Simulating the CSS box model
      8m 11s
  8. 21m 17s
    1. Understanding object appearance
      4m 43s
    2. Applying and editing live effects
      3m 34s
    3. Creating and using drop shadows
      3m 13s
    4. Creating more flexible rounded rectangles
      3m 17s
    5. Saving appearance as graphic styles
      6m 30s
  9. 35m 57s
    1. Starting with a wireframe
      5m 23s
    2. Adding master elements
      6m 45s
    3. Creating navigation buttons
      13m 34s
    4. Working with photographs
      5m 50s
    5. Simulating pages with artboards
      4m 25s
  10. 54m 45s
    1. Creating video placeholders
      10m 33s
    2. Creating buttons
      13m 1s
    3. Creating form fields
      8m 15s
    4. Creating radio boxes and checkboxes
      5m 11s
    5. Creating progress bars
      10m 12s
    6. Creating tabbed interfaces
      7m 33s
  11. 35m 28s
    1. Understanding slicing
      3m 26s
    2. Slicing up a mockup
      3m 6s
    3. Understanding web file formats
      5m 33s
    4. Exploring the Save for Web dialog
      3m 50s
    5. Optimizing photographs
      4m 29s
    6. Optimizing transparent graphics
      4m 43s
    7. Saving Retina display graphics
      3m 46s
    8. Exporting SVG graphics
      6m 35s
  12. 9m 29s
    1. Understanding image sprites
      3m 4s
    2. Creating a sprite grid
      4m 36s
    3. Optimizing sprites for the web
      1m 49s
  13. 15m 29s
    1. Placing Illustrator Smart Objects
      3m 22s
    2. Sharing color swatches between apps
      2m 9s
    3. Exporting Illustrator artwork as a PSD
      3m 49s
    4. Importing artwork into Fireworks
      2m 41s
    5. Exporting HTML from Illustrator
      3m 28s
  14. 1m 19s
    1. Taking the next step
      1m 1s
    2. Goodbye
      18s

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
please wait ...
Illustrator for Web Design
5h 27m Appropriate for all Jul 30, 2012

Viewers: in countries Watching now:

This course reveals how designers can create vibrant web graphics, wireframes, and complete web site mockups with the strong layout and color management tools in Adobe Illustrator. Author and Adobe Certified Expert Justin Seeley covers topics such as building responsive layouts with artboards, producing custom color palettes and swatches for web graphics, and making vector shapes and text that seamlessly scale. The course also explores adding drop shadows and other live effects, setting up interface elements such as forms and tabbed interfaces, optimizing and exporting different types of graphics, and speeding up your workflow with reusable image sprites and Smart Objects.

Topics include:
  • Customizing a web workspace
  • Decoding the mysteries behind screen size and resolution
  • Working with Pixel Preview and anti-aliasing
  • Coloring web graphics
  • Renaming and grouping layers
  • Working with shapes and symbols
  • Creating wireframes on a grid
  • Styling text
  • Creating image sprites
  • Simulating web pages with artboards
  • Optimizing and exporting your work
Subjects:
Design Web Web Graphics Web Design Web Foundations
Software:
Illustrator
Author:
Justin Seeley

Simulating the CSS box model

Regardless of whether or not you are adept at writing your own CSS and HTML, it is very important for you as a web designer to understand how both of those technologies work, especially when it comes to CSS. And so in this movie we're going to be exploring something called the CSS box model and how you can simulate that inside of Adobe Illustrator. And so here on my screen I have a little mockup of the CSS box model, and so basically what we're seeing here is how objects are interpreted on the web as CSS.

These are something that we call divs, and when you create a div on the Internet you have three basic areas that apply to that div. You have the inner portion here, which contains the content as you can see. We also have the out portion, which is something called padding, which helps create a little bit of space inside of the div to sort of cushion the content. That's why you can think of it as padding, it gives you cushion. And then on the outside, this red area here is called the margin area. This is the area that separates the content from other surrounding content elements.

So when we're defining objects on the web we define them as a content area with a width and a height value. We define a padding value to give them a specific amount of padding. Then we define a margin to determine how far other objects will be from this particular object. Now you're also noticing that I have a black stroke right here on this object. That indicates the border. You can also add a border to the element. The border of the element lies on the padding element only though. If you have no padding applied, the border will apply itself directly to the content area.

Applying a border to something with padding applies it on the inside, like this. The border will not go on the outside of the margin area. In most cases, the margin area will actually be a transparent area that is defined simply by a pixel value, so in all actuality all you would probably see if this were a true piece of CSS or an object in CSS, you would actually just see everything up into the border and the red background would not exist. Let's take a look at how we can start to simulate this box model inside of Adobe Illustrator to make it a little bit easier for us to translate our designs over to the development side.

I have open here an example of some sidebar content that I want to include on a blog design that I'm working on. And so what I need to do here is define a content area and then also add some padding to it, add in some colors, and then if I want to, I can also define margins a little bit later. But in this case I think I'm just going to define the content area and the padding to get a better idea of how that works. So the first thing I need to do is select the object with my Selection tool. With that done, I'm going to go up to the Type menu and go down to Area Type Options.

Once I get into the Area Type Options dialog box, I have an option down here at the bottom called Offset and then inside of Offset I have Inset Spacing. And Inset Spacing basically allows you to add padding around the outside of whatever text object you're working on. And if I click Preview and then start to increase the Inset Spacing, watch what happens. I'll crank that all the way up to 20, and you'll notice as I'm doing this the overall width and height of the box remains the same. It's just adding the padding inward. And that's what padding actually is; it's inset spacing.

And so it's also caused my text to sort of overflow and that's okay. I can rearrange this after I get out of this box. But let's say that I wanted to add 20 pixels of space all the way around the outside. Then I enter an Inset Spacing of 20 and I'm ready to go. Now it should be noted here that you can add different amounts of padding when you're working with CSS. You can different padding to the top, left, right, and bottom, but in Adobe Illustrator, you can only simulate the padding through Inset Spacing and that's just a one-shot deal. You get one increment to go all the way around evenly.

And so once I do that, I'm going to go ahead and click OK. And if I need to resize this, I just take this and drag it down and it resizes without any problem. You notice the inset spacing remains the same all the way around, so, pretty neat. Now what if I wanted to add a color to the back of this, because it's going to be a sidebar element, almost like a widget for instance. So let's add some color to the background. I'm going to have to use something called the Appearance panel in order to do this, so I'm going to go up to the Window menu and make sure Appearance is checked. It is. That means it should somewhere over here. And so if I find that I can drag it out into my workspace, and I can start to work with it.

You'll notice that as I have this entire object selected that I get this indicator here indicating I have a type object selected, and that's exactly right. You should think of type objects as a group of things, because this is merely a group of characters together. If you were to double-click on the word "characters," it would actually switch you to the Type tool and allow you to edit the type individually. So by clicking on that Type section, you're actually targeting the entire group. So I'll switch back to my selection tool for a moment and then click on the type to make sure I'm targeting that. And then once I have that selected, I'm going to then add a new fill on top of it.

So I'll click this to add a new fill, and you'll notice when I do that it adds a new black fill on top, and my text actually went from the brownish color that it was to this black fill. Well, the problem with that is it's applied to the text; it's not actually applied to the box. And so what I need to do is change this fill to be applied to the overall rectangle. First of all, I'm going to collapse this up, so I get a little bit easier to read. I'm going to make sure the fill is selected, and you can tell that because it will be highlighted. And then I'll come down here to the fx icon and when I get to the fx icon, I can go all the way up here to Convert to Shape and select Rectangle. And once I do that, I'll click Preview, and you can see exactly what's going on in here.

By default, it's going to give me a relative option here to say extra width and extra height, and that's going to add some extra space on the outside of the padding area that we defined earlier. Now, this is a great way to simulate margin, but if you want the color to simply be maintained within the padded area and not outside in the margin area, then you would actually need to set this to zero. So I'm going to set this back all the way down to zero, and you can click or you can simply enter in the value zero. No big deal either way.

And so now this is constrained within the padded area and I've got the shape set to rectangle. Everything looks good. I'll hit OK. And now I need this fill to be behind the text, because right now it's overflowing the text. So what I'm going to do is click here and drag this down until I see a little white line appear underneath characters, and then I will release. Once I release that, the text pops back up on top. I can then change the color of the fill by clicking to access this. And let's say I wanted to make this sort of a yellowish color, something like this. Click away, and there we go.

So now I can bring my Appearance panel back over here and dock it on the right, and I've got a really nice representation of what this div would look like in CSS. And so theoretically, this div would be X amount tall by X amount wide, with 20 pixels of padding all the way around it. Now what if we're working in Illustrator and we feel the need to resize this box? Well, if I click and drag out to the right, you'll notice that the box resizes without any problem. If I click and drag down to the left, it resizes without any problem as well.

So you can actually control the width and height of the box without skewing the text, simply by clicking and dragging around just like you would any other object. That inset spacing remains the same no matter what you're doing. So this is a great way to sort of simulate the actual CSS layout inside of your Illustrator mockups by utilizing inset spacing and also converting these fills to the shape of a rectangle to add a little bit of color or even add some margin space to the outside as well.

So the next time you are mocking up things inside of Illustrator, try to utilize this technique to simulate this box model, and you'll be really glad you did, especially when you start to take this into your CSS. Or if you hand it off to a developer and they take a look at it, they'll be able to say "oh, okay he's got 20 pixels of inset spacing. That equates to 20 pixels of padding." It just makes it easier for everybody all the way around.

Find answers to the most frequently asked questions about Illustrator for Web Design.


Expand all | Collapse all
please wait ...
Q: Where can I learn more about graphic design?
A: Discover more about this topic by visiting graphic design on lynda.com.
 
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.
Upgrade now


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 Upgrade now

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 Illustrator for Web Design.

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 preferencesfrom 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.

Are you sure you want to delete this note?

No

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.