Is there a better way of drawing a border inside a vector object other than drawing one vector shape on top of another and then resizing (as in my example image below)? I'd prefer to set it on the actual main object itself so when I resize it retains the correct spacing etc.
It would be good to say what methods you have already attempted. There are several ways to accomplish what you're asking and it would be good to know if any of them didn't specifically work.– paulmzOct 9, 2015 at 15:12
ahh, yes, apologies. So, I tried the approach pretty much as described below, creating two shapes, one on the top of the other (the top one with a dashed border). What I was really wondering was whether I could set the border to be inset, say 5px, just using one shape, if that makes sense.– user52229Oct 9, 2015 at 15:30
Sorry, you can't combine two separate shapes and maintain them as separate colors. The "group" option is the best practice for this. On the off-chance that the dashed line doesn't need to be a specific color, you could cut it out of the background rectangle with Pathfinder. Then the dotted line would be part of the rectangle, but the dotted line would also be transparent.– paulmzOct 9, 2015 at 16:10
1Possible duplicate of Adding dashed lines inside a shape in Illustrator– CaiFeb 5, 2017 at 16:52
There are a few ways to achieve this, but the simplest way is usually the best:
- Draw your background rectangle.
- Draw your "border" rectangle.
- "Group" the two rectangles and they will resize together.
I've got a sort of cheat for doing this. You can have it all on one object, you just set two strokes in the Appearance menu (Illustrator). The first one is your dashed line, set it to Inside and let it extend to, let's say, 6px. Then, make the second one, set it to Inside and make it a pixel or two thinner. Apply the fill colour of the rectangle to it and put it on top of the first one. And that's it! You can resize is as much as you want. It can also be any shape, even a custom one. Hope this helps (:
1If you're using the appearance panel you can just add an offset path effect to the stroke you want inset (see my answer here).– CaiFeb 5, 2017 at 21:38
Oh, man! That's true, I hadn't thought of the fx pannel! This is great, thank you (:– Mat DFeb 8, 2017 at 1:13