Generating web graphics from Illustrator used to be a tedious process that involved creating web slices (pieces) of the art, then saving those slices in a web-optimized format. Adobe has made that process much simpler. A typical workflow when building a website is for a designer to create the look and feel of the site and then hand off the various graphic elements and type specifications to a programmer for assembly in an application such as Dreamweaver, where the HTML code defines the elements that make up the web page, and an associated CSS (Cascading Style Sheet) file defines the appearance of those elements. With Creative Cloud, Illustrator introduced a CSS Properties Panel that streamlines the process for both the designer and programmer.
This technique applies to Illustrator CC versions
- We'll start with the graphics. When graphics are exported for web, vector art is rasterized, and converted to a bitmap made up of pixels that will display properly on the screen. Where color transitions occur, such as a black shape against a white background, areas where the black slices through pixels are anti-aliased. This means that those edge pixels wills display as a shade of gray, and it can make the art look fuzzy. While this is unavoidable on curved or diagonal edges, there's no reason for this on vertical and horizontal edges. To see what the art will look like on screen, zoom in, then go to View > Pixel Preview. Note the gray vertical edges in the letter shapes below:
- Use the Selection Tool and the Select All command (Ctrl+A) to select everything on the artboard, then go to the Control Panel and click the Align Selected Art to Pixel Grid button.
- Now to export the assets. You can see in the screen-shot below that the layers in this file have been organized much like a web page is structured
- Select a graphic element on the artboard. (In this case, the Header graphic is selected.) Go to Window > CSS Properties and examine the message in the lower portion of the panel.
- In the Layers Panel, double-click the selected object's name and change it to an appropriate web name, such as "header-bkg", Make sure to press enter to commit the name change.
- Continue renaming all of the graphic elements in the Layers Panel.
- Deselect everything in the file. Click the CSS Properties Panel menu and select Export All.
- Navigate to your correct folder and click Save, then review the options in the next dialog box and click OK.
- Go to your desktop and take a look at the folder. You should see PNG image files have been generated for all the elements you renamed, as well as a CSS file.