Search code examples
cssdjangodjango-templatesjustifytemplatetags

I can not use django template-tag linebreak and justify


I try to justify some text that i get from my database but I also need to use the template-tag linebreak.

html:

<p class="justify">{{ article.contenu|linebreaks }}</p>

css:

.justify
{
    text-align: justify!important;
}

My text won't justify itself unless I remove linebreak tag.

Got any idea how to use justify and linebreak tag together ?

Cordially


Solution

  • Use this Django filter:

    <p class="justify">{{ article.contenu|linebreaksbr }}</p>
    

    I hope this help you, thank you.