简体   繁体   中英

html template not rendering correctly for dynamic html content in django

I have strange issue in HTML template rendering, I have template index.html , in that template i passing dynamic content, here i have placed that code

<p class="font-secondary paragraph-lg text-dark" style="color: black;">
            {{ portal_contact_home_about|safe }}
        </p>

in portal_contact_home_about this variable it contains data like "<p>Lorem ipsum</p>" , so data should have to be render like this

<p class="font-secondary paragraph-lg text-dark" style="color: black;">
                <p>Lorem ipsum</p>
            </p>

but it is rendering it as wrong way

    <p class="font-secondary paragraph-lg text-dark" style="color: black;"></p>
<p>Lorem ipsum</p>

can anyone please help me how to resolve this issue?

instead of using two p tags use as follows

<div class="font-secondary paragraph-lg text-dark" style="color: black;">
  <p>Lorem ipsum</p>
</div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM