title: CSS doesn't work with xhtml2pdf Django
body: <p>I'm trying to improve my generated PDF created by <code>xhtml2pdf</code> with some <code>CSS style</code> in my <code>Django Project</code>. </p>
  
  <p>I would like for example to <code>justify a text block</code>, but apparently, it doesn't work and I don't find why. I'm reading lots of documentations about this library, I wrote some CSS scripts but still nothing.</p>
  
  <p><strong>This is my HTML file :</strong></p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
      {% load staticfiles %}
      &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;   
      &lt;link rel="stylesheet" type="text/css" /&gt;
  
      &lt;style&gt;
              p {text-align: justify;}
      &lt;/style&gt;
      &lt;/head&gt;
  
      &lt;font face="Courier New, monospace"
  
      &lt;body&gt;
          &lt;logo class="logo"&gt;
          &lt;img src='/Users/valentinjungbluth/Desktop/Django/Etat_civil/Etat_civil/static/images/logo.png' /&gt;
          &lt;/logo&gt;
          &lt;h2 align="center"&gt; &lt;font color="red" size="6"&gt; ACTE DE NAISSANCE &lt;br /&gt; COPIE INTEGRALE &lt;/font&gt;&lt;/align&gt; &lt;/h2&gt;
  
          &lt;br&gt;&lt;/br&gt;
          &lt;br&gt;&lt;/br&gt;
  
          {% block content %} 
  
          &lt;h3 align="left"&gt; ACTE DE NAISSANCE N° {{birthcertificate.id}} / {% now "Y" %} {{birthcertificate.firstname}} {{birthcertificate.lastname}}&lt;/align&gt; &lt;/h3&gt;
  
          &lt;br&gt;&lt;/br&gt;
  
          &lt;p&gt;Le {{birthcertificate.birthday}} est né, {{birthcertificate.firstname}} {{birthcertificate.lastname}}, du sexe {{birthcertificate.sex}}, &lt;br /&gt;
          de {{birthcertificate.fk_parent1.firstname}} {{birthcertificate.fk_parent1.lastname}}, né à {{birthcertificate.fk_parent1.birthcity}} ({{birthcertificate.fk_parent1.country}}) le {{birthcertificate.fk_parent1.birthday}}, {{birthcertificate.fk_parent1.job}},&lt;br /&gt;
          et de {{birthcertificate.fk_parent2.firstname}} {{birthcertificate.fk_parent2.lastname}}, née à {{birthcertificate.fk_parent2.birthcity}} ({{birthcertificate.fk_parent2.country}})&lt;br /&gt;
          le {{birthcertificate.fk_parent2.birthday}}, {{birthcertificate.fk_parent2.job}}, domiciliés au {{birthcertificate.fk_parent1.adress}}.
          &lt;/p&gt;
          &lt;br&gt;&lt;/br&gt;
  
              Dressé le {% now "SHORT_DATETIME_FORMAT" %} à ... , lecture faite et invité à lire l'acte, a signé avec Nous, &lt;br /&gt; {{user}}, chevalier de la Légion d'honneur, officier de l'Etat Civil.
  
  
          &lt;h3&gt; Le {% now "SHORT_DATETIME_FORMAT" %}
          &lt;br /&gt; Par la présente, l'Officier d'Etat Civil certifie la conformité de la présente déclaration &lt;/h3&gt;
  
          &lt;br&gt;&lt;/br&gt;
  
          &lt;h3 align ="right"&gt; L'Officier d'Etat Civil &lt;/align&gt; &lt;/h3&gt;
          &lt;h3 align ="right"&gt; Signature et tampon &lt;/align&gt; &lt;/h3&gt;
  
          {% endblock %}
  
          &lt;/font&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When I generate the PDF, I get this file :</p>
  
  <p><a href="https://i.stack.imgur.com/3MRPV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3MRPV.png" alt="enter image description here"></a></p>
  
  <p>As you can see, the block text is not justified. I also tried to add a <code>background-color</code> but always the same problem, it doesn't take account.</p>
  
  <p>Thank you so much if you have an idea !</p>
  
  <p><strong>EDIT :</strong></p>
  
  <p>I found the answer : sentences were not enough long to justify the text !</p>