Creating flexible text boxes in Illustrator


I'm going to be making images that include hundreds of lines of text of varying lengths, each of which will have the same "background", with the exception of the length of the background, which will need to be relative to the length of the text. I want to not have to manually fit text to a box each time.

The second twist is that I want the background to be reduced opacity, but I want the text to be 100% opacity.

So the text will always be the same size and solid white, over a (say) 80% opacity orange background. The "padding" (inset?) on all four sides of the text the text will be constant relative to the text. All that will change is the overall width of the text string, consistent with the overall width of the "box".

I have reviewed these two answers

How to fit text box size to text?


Change Background Color of Text Box in Illustrator CS5

which would seem to address this but don't quite. I am using Illustrator CS6.

4/13/2017 12:46:00 PM

Accepted Answer

As for fitting text boxes to text.. see the script in your first question link. That's the only method I'm aware of.

The fill issue is MUCH easier to solve.

  • select the area text with the Selection Tool (black arrow)
  • Add a new fill via the Appearance Panel
  • set fill color and drag the fill below the Characters item in the Appearance Panel
  • With the fill highlighted in the Appearance Panel, choose Effect > Convert to Shape > Rectangle and enter values you want. Then click OK
  • Click the Opacity indicator under the fill in the Appearance Panel and enter the Opacity you wish the fill to have. This will not alter the text.


Set this up once, then drag the whole thing to the Graphic Styles Panel. When you need to apply this same appearance, simply select the Area Text box and then click the style in the Graphic Style Panel.

Note, the background is relative to the Area Text box... if the box changes size, the background will as well.

Added after seeing what the script does to the appearance.

The script does kill the appearance. So here's what I would do...

Set up the Graphic Style and save it.
Have an Area text box set up and ready for the script.

Now create a new Action and start recording...
- Run the script
- click the Graphic Style
Stop recording.
Assign an F key to the action.

Now all you need do is select an Area Text Box and hit the assigned F key. If the text box needs resizing while working, just tap the F key.


Illustrator has, and has had, a bug where scripts in actions are concerned. The action will not retain the script step if you quit Illustrator. So each time you launch Illustrator you would need to set up the action again. It's annoying, time consuming and a pain. However, recreating the action each time it's needed may be much faster than manually manipulating text boxes and appearances.

1/29/2013 2:05:00 AM