1

Using Jijna2, I'm trying to make a responsive HTML email template which is almost simple

<!DOCTYPE html>
<html>
 <body>
 <p><strong>Hello</strong>,</p>
 <p>Below are the deals running on <a href="https://www.{{ url }}.com">{{ url }}</a> at <strong>{{ date }}</strong>:</p>
 <p>&nbsp;</p>
 
 <ul>
 {% for image in images %}
 <a href="{{ image }}">
 <img src="{{ image }}" width=500" height="200">
 </a>
 {% endfor %}
 </ul>
 <p><strong>Regards,</strong></p>
 <p>Team</p>
 </body>
</html>

That's what is shown currently:

enter image description here

and during full screen:

enter image description here

How to make it responsive in this case and keep the display of images one by one. not side by side during full screen or mobile screen!

davidism
128k31 gold badges417 silver badges348 bronze badges
asked Jun 30, 2021 at 16:48
1
  • Surrounding images with list items as <li style="width:100%"> ? Commented Jun 30, 2021 at 16:59

3 Answers 3

2

I won't consider this responsive but to keep images one on top of each other, you can try to just have them as list items and hide the list bullets with list-style: none, like:

<!DOCTYPE html>
<html>
 <body>
 <p><strong>Hello</strong>,</p>
 <p>Below are the deals running on <a href="https://www.{{ url }}.com">{{ url }}</a> at <strong>{{ date }}</strong>:</p>
 <p>&nbsp;</p>
 
 <ul style="list-style: none">
 <li>
 <a href="#">
 <img src="https://via.placeholder.com/500x200" width=500" height="200">
 </a>
 <li/>
 <li>
 <a href="#">
 <img src="https://via.placeholder.com/500x200" width=500" height="200">
 </a>
 <li/>
 </ul>
 <p><strong>Regards,</strong></p>
 <p>Team</p>
 </body>
</html>

Or as I told you in comments, make the anchor link to have full width like: <a href="{{ image }}" style="width:100%">

answered Jun 30, 2021 at 19:02
Sign up to request clarification or add additional context in comments.

Comments

1

You can simply use a class on the image container li and then make that class have a width of 100% using css

So in your case:

<style>
.full-width{
 width: 100%;
}
</style>
<!DOCTYPE html>
<html>
 <body>
 <p><strong>Hello</strong>,</p>
 <p>Below are the deals running on <a href="https://www.{{ url }}.com">{{ url }}</a> at <strong>{{ date }}</strong>:</p>
 <p>&nbsp;</p>
 
 <ul>
 {% for image in images %}
 <li class="full-width">
 <a href="{{ image }}">
 <img src="{{ image }}" height="200">
 </a>
 </li>
 {% endfor %}
 </ul>
 <p><strong>Regards,</strong></p>
 <p>Team</p>
 </body>
</html>

Should do the trick.

answered Jun 30, 2021 at 18:56

Comments

1

Good morning Ahmed, what you can do is insert the css code you need to behave responsively, as in the example:

<style type="text/css">
 body {
 margin: 0;
 padding: 0;
 }
 table,
 td,
 tr {
 vertical-align: top;
 border-collapse: collapse;
 }
 * {
 line-height: inherit;
 }
 a[x-apple-data-detectors=true] {
 color: inherit !important;
 text-decoration: none !important;
 }
</style>
<style id="media-query" type="text/css">
 @media (max-width: 520px) {
 .block-grid,
 .col {
 min-width: 320px !important;
 max-width: 100% !important;
 display: block !important;
 }
dbc
121k27 gold badges273 silver badges406 bronze badges
answered Jun 30, 2021 at 16:59

1 Comment

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.