Make the text under image stay put

Make the text under image stay put
0

#1

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.


#2

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;
}

#3

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


#4

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.


#5

Ye i understand but then it will stay in the center but what if i want it
https://gyazo.com/9ea0163bf53354827e154e42332d39aa to stay here at the start of the left corner