What's new
Photoshop Gurus Forum

Welcome to Photoshop Gurus forum. Register a free account today to become a member! It's completely free. Once signed in, you'll enjoy an ad-free experience and be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

How do I create a text box with moving background?


recipesbynora

Member
Messages
20
Likes
0
Hello,

Happy holidays to everyone!

I wanted to ask how I could create a text box so that when I type, the white background rectangular shape (with the option to put black borders on it) moves with the text. The effect I want is attached. My current workflow is to create a text box and type a word/s then create another rectangular shape and bring it behind the text and adjust the size of the rectangle so that it covers the text with some padding on the sides. Thank you for your help!

Mark

Screen Shot 2021-12-22 at 2.00.56 PM.png
 
I tried researching this and, to the best of my knowledge, it can't be done. I have not found any way to create a text box that dynamically resizes itself to fit whatever text is typed into it. Perhaps there is an action that can be written, but I personally don't know anything about actions or scripts.

The closest I came is this: with the text tool active, if you click the mouse on a spot and then drag-out a rectangle, it forms a bounding box. Once you start entering text, the text will wrap itself to fit within the box. But I have not found any way to then select that box and apply any strokes or fills to it.
 
If this is for your website, isn't this usually a function of HTML, JavaScript, etc?

In Ps, you can do this manually with a single stroked rectangle and centering text, or like Rich stated above, with an action or script.

Create a rectangle with the Rectangle Tool using your preferred height..........the width will be changed. Add a stroke.
Screen Shot 2021-12-23 at 7.56.37 AM.png

Add text and center.
Screen Shot 2021-12-23 at 7.56.46 AM.png

Copy the rectangle layer and the text layer...
Screen Shot 2021-12-23 at 7.57.16 AM.png

Select the copy and change the text.
Screen Shot 2021-12-23 at 7.57.49 AM.png

Use free transform (and properties panel for precise adjustments) to resize the copied rectangles width.
Then center your text.
Screen Shot 2021-12-23 at 8.03.52 AM.png

To center text, use the Move Tool. Make a selection of the rectangle by holding Cmd/Cntrl and clicking on the rectangle layers thumbnail.
Screen Shot 2021-12-23 at 7.58.54 AM.png

Select/Highlight the text layer.
Then use the alignment tool in the tools options bar to center.
Screen Shot 2021-12-23 at 8.07.58 AM.png

This entire technique can be done in about 30 seconds once you have figured out the steps. An action may require a slightly different approach.
 
I tried researching this and, to the best of my knowledge, it can't be done. I have not found any way to create a text box that dynamically resizes itself to fit whatever text is typed into it. Perhaps there is an action that can be written, but I personally don't know anything about actions or scripts.

The closest I came is this: with the text tool active, if you click the mouse on a spot and then drag-out a rectangle, it forms a bounding box. Once you start entering text, the text will wrap itself to fit within the box. But I have not found any way to then select that box and apply any strokes or fills to it.

Hi Rich!

Thanks for your response. Yeah, I hope there is a way so that the workflow will be easier and efficient. I tried doing what you suggested. When I typed two words for example the second word disappears (goes to the second line). Then I would need to adjust the height or width of the rectangle to fit both words.
 
If this is for your website, isn't this usually a function of HTML, JavaScript, etc?

In Ps, you can do this manually with a single stroked rectangle and centering text, or like Rich stated above, with an action or script.

Create a rectangle with the Rectangle Tool using your preferred height..........the width will be changed. Add a stroke.
View attachment 126625

Add text and center.
View attachment 126626

Copy the rectangle layer and the text layer...
View attachment 126627

Select the copy and change the text.
View attachment 126628

Use free transform (and properties panel for precise adjustments) to resize the copied rectangles width.
Then center your text.
View attachment 126630

To center text, use the Move Tool. Make a selection of the rectangle by holding Cmd/Cntrl and clicking on the rectangle layers thumbnail.
View attachment 126631

Select/Highlight the text layer.
Then use the alignment tool in the tools options bar to center.
View attachment 126632

This entire technique can be done in about 30 seconds once you have figured out the steps. An action may require a slightly different approach.

Hi Sam,

Thank you for your detailed response. This is exactly what I do every time! Except for the last part in centering the text, I just freely move the text and estimate if it is already centered in the rectangle and I adjust the width of the rectangle as needed. I will try your approach in centering the text it will definitely cut some editing time. Thanks again!
 
This is exactly what I do every time!
Almost, I'm not creating a text box as you described. So it should save you time.

Edit: There's no need for a click and drag "text box". Just click once with the Type Tool and go.
 

Back
Top