# Text over image

**URL:** <https://community.hubspot.com/t/text-over-image/10857>\
**Category:** CMS Development\
**Created:** [November 8, 2018, 3:08pm UTC](https://community.hubspot.com/t/text-over-image/10857 "2018-11-08T15:08:18Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [November 8, 2018, 4:49pm UTC](https://community.hubspot.com/t/text-over-image/10857/2 "2018-11-08T16:49:04Z")

</div>

Hi @ElineTribes,

there are some different ways that will get this to work.

In my opinion the easiest(and cleanest) one would be to “write” a custom module. It’s easier than it sounds 😉

Simply create a new module and give it to widgets/modules

- an image one

and

- a (rich)text one

the image snippet looks something like this:

```auto
{% if module.image_field.src %}
	<img src="{{ module.image_field.src }}" alt="{{ module.image_field.alt }}" width="{{ module.image_field.width }}" height="{{ module.image_field.height }}">
{% endif %}

```

and the text one something like this:

`{% inline_text field="text_field" value="{{ module.text_field }}" %}`

to get the image “behind” the text you should add the image snippet to an inline background-image style. Since a background-image doesn’t need an alt-tag or sizes your code should look like this:

```auto
<div class="row" id="my-pretty-background-image-wrapper" style="{% if module.image_field.src %}background-image:url({ module.image_field.src }});{% endif %}">
<div class="container"> 
<div class="span12">
<div class="my-pretty-headline">
<p>{{ module.text_field }}</p>
</div>
</div>
</div> 
</div>

```

also should consider to style the image via CSS and give it a cover-size

```auto
#my-pretty-background-image-wrapper{
background-size:cover;
background-position:center center;
}

```

regards

Anton

| ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/7/1/71232bb65bd029237c40010174d30ea2bb57cbd6.png) | Did my post help answer your query? Help the Community by marking it as a solution |  
| — | — |

---

_[View the full topic](https://community.hubspot.com/t/text-over-image/10857)._
