Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Perhaps the most efficient way to define slices in Illustrator is using a feature called object-based slicing. Well, after all, Illustrator is an object-based program. We are focusing on using objects, like rectangles and vector shapes, so on and so forth. It only makes sense to use those very objects which we're already using in the Transform panel to ensure that they are the right size, and use those objects to also define our slices. Here is one of the nicest things about using that method. If we ever update or change our object, because the slice is based on the object itself, the slice also changes to match that.
In other words, it means it's kind of a live slice that always updates itself based on your content. It's a great concept, and let's see how we actually apply it, here inside of Illustrator. Now we're going to use this for two examples here. I'm going to focus right now on an entire web page, where we're going to be using slices to define these divs for our web page, and at the same time I'm also going to show you how to take slices that are defined by objects and use them to create individual graphics, things like maybe banner ads or other web graphics that you might create. So let's see how those work.
Now in this example here, I have my web page, but I also have the grid that I've defined that help me first create my design. I use just regular, plain rectangles to draw this grid. In fact, I'm going to the View menu here. I'm going to choose Guides, then I'm going to choose Hide Guides, just so that they don't get in the way here. We want to focus on the artwork itself that's right on the page. These here are regular rectangles, and we use this when we first started designing the actual grid for our layout. Now remember, when we first started actually drawing these rectangles, we actually drew and positioned them using the Transform panel.
So every single rectangle that I see here is at exact precise size and in the right location. The way that Illustrator works is that you could take any object, you can go to the Object menu and choose Slice, and then choose Make. This takes that object that you currently have selected and uses it as the basis to create a slice. So if I choose this option right now, Illustrator automatically creates a slice around that object, and the beautiful thing is that if I move this rectangle somewhere else, you can see that the other slices update automatically.
If I resize this object, this slice itself updates automatically as well. So I'm going to actually press Undo a few times to go back to the state I was in before I actually created that slice. I want to show you how I can take this grid now that I created and instead of just throwing it out or wasting it, I can use this grid to help me define a perfect slice table for this page here. Now again, don't worry about the fact that we're creating a table here, because at the end of the day, we could take the slices that we create and turn it to anything we want. We just want to define the right regions here.
So let's see how to do that. I'm going to select all this artwork right here, and I'm going to press Command+C, or Ctrl+C, to the copy it. Then I'm going to click on this artboard so that now this artboard is the active artboard, and I'm now going to choose Edit > Paste in Place. That's going to take this grid and position it precisely in location, right on top of the artwork that appears on this web page. We can't see the artwork right now, because it's being covered by this artwork, but that's fine. We have several ways to deal with this.
Sometimes I'll actually create a separate layer, specifically for my slices, and that might be a really nice way to manage that process. I can now create a new layer, and I could take the art that's on this layer right now, that's currently selected, the little colored dot that appears in the far right of a layer shows what artwork is currently selected. And if I take that little dot and I drag it into layer 2, that means I'm now moving all of that artwork onto the second layer. Just to show you if I now choose to hide layer 2, those objects go away.
So I'm going to turn that layer 2 on right now, and I'm also going to select everything in that layer. Now I don't have a little colored dot here, but if you just click in his blank area, it actually selects all the elements on that layer. So right now, all the rectangles that I created that I'm going to be using for my slices are currently selected on layer 2. I'm simply going to come up over here to the Control panel and change the fill color to None. So now those objects have a fill and a stroke of None, meaning I can't see them; they're invisible.
However, I want to use those objects. I want to use the boundaries of those objects to define slices. So now with those objects still selected, I'm going to up to the Object menu, I'm going to choose Slice, and then I'll choose Make. Now Illustrator will automatically now find the regions, or the boundaries, of each of those objects, turn them into slices for me. Now, I can come to layer 2 and simply lock it. So as I'm working on my design, I don't have to worry about accidentally moving or adjusting those slices, because now that serves as the basis for how my artwork is going to be exported when I start thinking about taking this design elsewhere.
This is one way to think about object-based slicing. Let's go to another example. I'm going to switch to a different document. It's called explore_ads.ai, and I have several pieces of art here that I'm working on. They can be for a variety of different purposes, either for different pieces of art that appears across an entire web site, maybe I'm working on some kind of an ad campaign. Notice over here I have here some ad banners that I'm working with, but I also have some individual graphics. I've already created some slices here in this document. This will allow me to export just the art that I need at just the sizes that I need them.
So, for example, I have some art down over here. It's a nice piece of art. I may need to use it on some different web pages. It's currently set to the right size. This piece of artwork is set to 200 pixels by 225 pixels. But what I can do now is just, with that art selected, go over to the Object menu, choose Slice, and then choose Make, And now that piece of art has a slice around it. Again, the beautiful thing about the object-based slice here is that I never know how I'm going to be working with my art. As I'm kind of working, I am moving things around. If I take this artwork now and I drag it over here, notice that the slice moves along with it.
If I had drawn that manually or used guides, the slice is really disconnected from the art whatsoever. It's kind of sitting on top of it as a different layer. So, that means that if I move the artwork, the artwork is now completely outside of that slice. But now no matter where I move this artwork around, the slice kind of goes with the object itself. Because each of these are separate slices, I can basically go into Save for Web dialog box that we've done in a previous chapter and maybe set these to export as GIF files or this one to export as JPEG. Maybe have this one export as a PNG.
Once those settings are done, those settings belong to the slice. That slice will always export with those settings. So once I lock it in, I can forget about it. That means as I'm working on artwork right now I need to make a quick change, let's say the Nature Watch, I need to change that star to something else. I can make a quick, little change to it. Then just simply select that object and then choose File > Save Selected Slices, and I'm done. I'm able to quickly export just that one piece of art, even though there're lots of other art inside of this document. So it's a great way to work inside Illustrator.
I'm not thinking about HTML tables here. I'm thinking simply about regions or different pieces of art that are being defined as separated pieces of art simply by the fact that they have had slices assigned to them. Of course, what really makes all this work is the fact that I'm using object-based slices. Illustrator knows that those objects have slices applied to them. And as I modify or change the artwork, the slice modifies with it, which allows me to focus more on the creative task at hand than worrying about how to export it each time.
Get unlimited access to all courses for just $25/month.Become a member