Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
If you are eventually going to code your page using HTML and CSS, it can be helpful when you are creating your mock-ups and your designs inside of Illustrator to be able to visualize how that's going to actually be created. For example, when working with content, it can be helpful to understand what's called the CSS box model. It's a way basically I can build layout using CSS. And in fact, in this layout that I have designed here inside of Illustrator, you can see that these sidebars that have been created are actually single objects. If I click and I move them around, notice that the background color and the text all moves as one unit.
These are not individual objects. I don't have here a group with some text in the background. It's actually one area text object, and I have built it in a way to stimulate the CSS box model, and it will help me visualize how I am eventually going to build this using CSS. So in this movie, I want to take a few moments to teach you how to build these types of constructs inside of Illustrator. I am going to start here by creating a new document, because the first thing I want to show you is exactly what the CSS box model is, just to give a basic idea of what we are talking about here. I take a rectangle here, and just draw a larger rectangle like this.
Maybe I will just draw another one out here. I am just going to draw a series here of rectangles, and I will get rid of the stroke here on the inside one. Let me select this middle rectangle here. Let's call this one like a darker gray, and then let's increase the stroke weight just a little bit, and then let's take this outside one here, get rid of the stroke on this one and give this a fill of a lighter gray. So what we have here basically is the basic concept of what the CSS box model is. Whenever you create an area, or what we call a div, inside of a layout using CSS, we have our content that kind of fits inside of it, and then we have an area here that we call a margin area.
It's basically how far away your content can come towards the edge of the div. Then you also have an area which we define as our border, so inside of Illustrator, we think of this as a stroke for example, and then you have an area on the outside which we call Padding, and this padding allows us to offset this div from the other areas as well. So we basically have these distinct areas here. We have our content, which is in the middle, we have margin area, we have a padding area, and of course, over here, we have the actual border itself.
So let's take a look at how we can actually build content in Illustrator to simulate this so that we can better visualize how to build things later on using CSS. So I am going to go ahead, and I am going to delete these objects right now. I am going to start with a regular text object here. I am going to create an area text object. I am just going to click and drag to draw the frame, and I am going to put some text in there. Here is some text. Again, it doesn't make any difference really what the text is now. We can apply text with a paragraph style that maybe we have created, but remember, eventually this text will be populated using HTML.
But for now I am just going to make this text little bit bigger. Here is little bit of a keyboard shortcut, Command+Shift +Greater Than Sign, or if you are on Windows that will be Ctrl+Shift+Greater Than Sign. Makes your text two points larger at a time, so I am going to go ahead and make that just a little bit bigger. And now we are going to start to work on our settings. So I am going to switch over here to my regular Selection tool, and I am going to go over here to the Type menu and choose Area Type Options. So the first that we are going to talk about is the margin setting. Remember, the margin setting was the area towards the inside of the border that allows us to kind of offset the text a little bit from the edge, or the border of the div.
So, if I click on the Preview button here on the Area Type Options dialog box, we will see that I have something here called Inset Spacing, and if I go ahead now when I start to increase that value, you can see that right now I am kind of moving the text towards the inside of this shape. So let's say I do 20 pixels here, for example. That means that I am creating, or I am simulating, a margin setting of 20 pixels. Now it's important to realize that in CSS you can have offset values that are different for top, bottom, left, and right. But here inside of Illustrator, we only have one uniform Inset Spacing setting, which basically is being applied to the entire shape itself.
Still, many times we want our margins to be the same way that way. So again, here inside of Illustrator, I am using the Inset Spacing setting to simulate the margin setting that I would have inside of CSS. Great! So I have done the first of them, and I am going to click OK to accept that value. Now let's talk about actual padding. That's the area towards the outside of the border that allows us to better make sure that there is enough space between the divs, for example. So I have now this shape over, and what I am going to is come over to my Appearance panel.
It's important to realize that inside of Illustrator, we can use the Appearance panel to modify the appearance of Artwork. Now, there is a concept of something called a group inside of Illustrator, and if we think about it, any text object inside of Illustrator is really a group. If we think about each of the characters in this text. For example, the capital H, the e, the r and the e, those are like individual objects, but if we think about a type object as a whole, that is a group that contains all these characters inside them. And in fact, if you look at the Appearance panel, we see that the bold word over here, what we call our target, is right now this type object, and there are characters inside of that.
In fact, if you double-click on Characters, it is if you are targeting specifically the text, and notice that Illustrator changed to my Type tool and highlighted the text using the Text tool. But if I use the Selection tool and I click on it, Illustrator goes ahead and targets the entire type object. Again, think of it as some kind of a group. So what I want to do now, if I wanted to simulate some kind of a color here in the background, what I can do is I am going to now create a separate fill on this group, which I am going to send behind the characters. And I am going to use that to define this other background area, which will become our padding.
So the first thing I am going to do is I am going to come over here, at the bottom of the Appearance panel, with my Type object selected, I am going to choose to add a new fill. Now, right now, this color is picking up the color of my text, which is black, but I can change this to any other color. So just for now I am actually going to change it to, let's say, this red color right now. I want to choose just a bright red color. Now I added now a second fill, so the red fill right now is covering over it. It's on top of the black fill so my text appears as if it's red. But here is the thing: right now, my text object exists, and Illustrator is using that red fill color for the text, but I want the red fill color to actually show the background of this shape of the rectangle, which I want it to be, for example, my div in my CSS layout.
So what I need to do is convert that text somehow into a rectangle. Well, Illustrator has such an effect. So the first thing I am going to do, again, staying in my Appearance panel here, I am going to click on the fill, so that the fill is now highlighted. See now how the fill is selected? I can now come to the bottom of the Appearance panel and click on the Fx icon and choose Convert to Shape > Rectangle. Now I want the rectangle to be a certain size. By default, Illustrator allows me to create what we call a relative width and height, meaning that I now have a certain dimension of that text frame.
Right now, the text frame has a width of 303 pixels and a height of 197. Illustrator is now adding 18 pixels to the both sides of the width over here, so to the left and to the right, and it's also adding 18 pixels as far as the height right over here. Now if I wanted to make it 20, I could just type in 20 over here, hit the Tab key, and type in 20. It's kind of an odd thing here. If I hit Tab again to accept that value, Illustrator thinks I am tabbing to the next value, which is here, and it sets its Absolute. So I am just going to go ahead and make sure that I click on Relative.
So right now I have an Extra Width of 20 pixels, and Extra Height of 20 pixels, which in my mind I could start to think of an extra width or an extra height, or basically extra 20 pixels of padding that now exists on the outside of the border area. So I am going to click OK, but you can see that right now this fill is covering over the text. I can't see the text. So if I look at my Appearance panel, the Appearance panel always displays artwork in the order in which it's drawn, and Illustrator always draws things in the bottom up.
So right now you can see that my fill is on top of the characters. It's covering over the characters. I am going to take this fill and drag it so that it now appears beneath the characters, and now I have some text with this color in the background here. So what I have basically now is the padding that I specified, I have the margin area that I specified, and if I wanted to also add a border here, what I would do is I would come here to the Appearance panel and then target the stroke. And remember, if I just add in a stroke here, it's going to add a stroke to the text.
So I need to do a similar concept here for the stroke, I need to, with the stroke target it, add also a Convert to Shape, Convert to Rectangle effect. In this case here, I want the Extra Width to be set to 0, meaning that my border now is going to be the exact same size of my rectangle. I am now going to change that to a weight of one, and now you can see that I have basically my area on the inside. This is my content. This is my margin area. This is my border area, and this is my padding area. So in this way, I can build Artwork to simulate this CSS box model to better visualize how I want my layout to be.
Now there is one other thing to note here. I have, currently, right now, my bounding box turned on, so if I go to the View menu here, there is an option that says Hide or Show Bounding Box. So with my Selection tool right now, I can change the size of this frame as I need to, and remember the padding, and the margin are always going to remain set to those 20 pixels the way that I set them. Because I have the Use Preview Bounds option turned on - remember we set that preference way back in the beginning of this video title - I am now seeing the actual size of this, where it says Width and Height that is taking to account both the padding and the margin also.
So I am seeing a true value that's right here. However, if I wanted to adjust the width right now, change it to, for example, 400 pixels if I did so through the Transform panel, the text is also going to get stretched. Now we don't want that. We want the frame to get bigger, but we don't want the text to get stretched or distorted as well. Well, there is two ways to do this, actually. I am going to press Undo. If I know for sure that I want the width here to be 400 pixels, I can go to the Type menu and choose Area Type Options, and enter a width of 400. However, when I do that, that does not take into account the extra 20 pixels of padding that exists on the left and right. So we can see over here, the Width is 440 because I am seeing an extra 20 on either end over here.
So the way that you can actually change the size here is to switch to your Direct Selection tool and then just click on just one of the sides of the object. Now change this, for example, to maybe let's say 350, and when I do so, I am able to adjust it without stretching the text. So going back to the page design document over here, that's how I build these areas right here, or the sidebar content, by basically taking an Area Type Object and using a fill that I sent that to the background that I converted to a rectangle, and also using the Inset setting for the Area Type Object to simulate the concept of both padding and margins in the CSS box model.
Get unlimited access to all courses for just $25/month.Become a member
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
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.
Your file was successfully uploaded.