Make the text under image stay put

How could i make my html p text stay under the image when max-width:40em on the image is reached. Been thinking on this for some time any help would be so cool.

You can give it a max-width and a margin: 0 auto, so it will center itself.

.my-selector {
  max-width: 500px;
  margin: 0 auto;

Oh ye that works i tried doing max-width: before on the p eleemnt but not margin: 0 auto but what if i want it at the start of the image like its shown in the gyazo. I tried doing max-width: 500px and marign: 0 1rem; and if i do that it dosent stay but. Thank you alot tho for the comment

For it to stay in the center you must have the auto like I’ve shown.

But you don’t need to use 500px for the max-width, that was just an example. You can use any value to make it adjust and stay exactly where you want.

Ye i understand but then it will stay in the center but what if i want it to stay here at the start of the left corner