HomePageText - Change img src in responsive designs?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
Hello

HomePageText, How to implement the following code?

<picture>
    <source media="(min-width: 1200px)" srcset="/images/desktop-size.png">
    <source media="(min-width: 768px)" srcset="/images/medium-size.png">
    <img src="/images/mobile-size.png"/>
</picture>
5 years ago
Hello,

You will have no problem implementing the HTML <picture> Tag in the Home Page text topic, but you will have to have in mind that this will not work on some older browsers and in all Internet Explorer versions. You can see where this is supported in caniuse.com/#feat=picture. Also, a problem you may face in this implementation is that the Rich Text Editor will discard the <picture> tag and will render it as an image tag, so you will have to add the element in the Razor View files. I suggest that you do that in the Home\Index.cshtml file, not in the \Shared\Components\TopicBlock\Default.cshtml.

I hope I was useful
Nikola
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.