1

I am using Sketch App and I want to create the exact illustration:

Sketch App Rectangle with Text

Creating rectangles is really easy, but how can I make a text in the border like <html> as you can see above?

2

You should use Dynamic button plugin https://github.com/ddwht/sketch-dynamic-button

Make your tags texts (<html>, <head>, etc.) as Dynamic buttons.
Set BG color to white.
Make paddings on test styles to 0:10.

enter image description here

Download sample sketch file

| improve this answer | |
  • Thanks! That looks great, but is it also possible to make the closing tag at the bottom? – John Doe Oct 13 '16 at 17:14
  • Of course, just duplicate dynamic button with required tag, make changes at text (adding /) and place it at the bottom. – zholdas Oct 13 '16 at 17:24
0

If you want that it is a rectangle and not a open path you need to mask the area where you want the text to appear.

Steps:

  1. Draw a rectangle
  2. Place text on desired place
  3. Create mask to reveal or hide desired areas of the rectangle that touch your text

Here a video about masks in sketch: https://www.youtube.com/watch?v=Db2SjUZhcHI

| improve this answer | |
  • If I create a mask of my rectangle it just disappears and the text is correctly masked, meaning only the area is visible that is right on the border of the rectangle. However, that's not what I want. Do I need to duplicate the rectangle to create a mask for the real rectangle? – John Doe Oct 13 '16 at 19:29

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.