How do I write text over a image?

Jump to solution
jessicanashemai
Community Novice

I am creating a homepage template and have images that I would like to overlay with text so they are editable to the user. Is there a simple way to do this? Example, if I have a blue square image imported and would like to write text in the box.

Labels (1)
1 Solution
aaron_bahmer
Community Contributor

This is not really a simple situation. Here's a link to the W3Schools page where the process is demonstrated. Tryit Editor v3.6 

Essentially, you have a <div> for text nested within a <div> for the image. The <div> with text is styled to use absolute locations for the text within a <div> styled to accept relative locations. This example also shows the image being styled to be partially transparent. Other CSS for images at CSS Styling Images.

You'll have to use the styles inline (<div style="">) and I'm not sure any of this styling will survive the TinyHTML editor once you save, though.

It might easier to use a <div> with a background-color styled in and then include the text. That will work with solid colors.

Another consideration is text contrast over the image/color - keep accessibility in mind.

View solution in original post