1

I have two rectangles with stroke width of 2px. How do I go about putting them side by side such that they share the same adjacent stroke border of 2px?

I tried dragging the rectangles to fit them into the stroke but there is no snapping. Is there a better way to do this?

Stroke border of 2 x 2px enter image description here

Rectangles share the same stroke. enter image description here

2

Draw one rectangle and then draw a 2px line and center it in the rectangle.

enter image description here

Unless there's some reason you must have two separate rectangles.


(Assumption that all strokes are set to the default stroke alignment, which is centered on their respective paths)

Realistically, if two rectangles are actually butted against each other, there is no variation in the appearance of a stroke....

enter image description here

Yellow boxes are all the same width.... as are the strokes. However this is two separate rectangles.

enter image description here

enter image description here

The key may be to use Outline Mode (View > Outline) to ensure your rectangles actually do butt against each other. Outline mode can be an invaluable feature if you are trying to be precise in positioning. There is simply no way to be as accurate working strictly in Preview Mode.

enter image description here

Enlargement:
enter image description here

Because if you have a gap or overlap between the rectangles:

enter image description here

.... and everything is stroked the same color, all you'll see in Preview Mode (View > Preview) is the apparent "thicker" stroke:

enter image description here

What actually happens is the two strokes overlap each other and are not aligned properly:

enter image description here

So, basically, this issue is ultimately because your two rectangles are not butting against each other.

Correctly aligned objects will have correctly aligned strokes which, when overlapping will not give the appearance of a thicker stroke.

You may also find it helpful to ensure Use Preview Bounds is not checked in the Preferences. This will allow snapping to use actual object paths for snapping rather than their preview containing the stroke appearance.

  • 1
    I am drawing three rectangles, how can i distribute the lines at 1/3 and 2/3 wdith respectively? – Carrein Mar 29 '18 at 1:03
  • 1
    @Carrein you can make the rectangle say 99px long, and draw a line every 33px (Just to make things simple) – WELZ Mar 29 '18 at 1:28
1

There are at least 2 way to do this.

First Way:

  1. Open Apperance Panel, set Align Stroke to Center to all rectangle (if not set)
  2. Select both rectangles, then select first once again (it will be a 'key object'), then open Align Panel (Shift-F7), set Distribute Spacing =0 and hit 'Horisontal Distribute Space'.

Second Way

  1. Delete second rectangle.
  2. Select first, then open Effect->Distort & Transform->Transform. Set 'Move Horisontal' to rectangular width, set Copy=1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.