1

I want to add background image for <li> element in template file. How to add background image in phtml file in magento2 ?

1 Answer 1

0

Try the below code:

<li style="background-image:url('<?php echo $block->getViewFileUrl('images/demo.jpg'); ?>')">Your text</li>

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.