padding-left for li似乎不适用于ITextSharp

时间:2016-01-19 14:58:19

标签: html itextsharp

我通过在字符串中传递html标记,使用ITextSharp 5.5.8生成pdf。

我正在尝试使用padding-left css样式调整列表项和文本的项目符号之间的宽度。但是,在生成pdf之后,当它在html中正常工作时,它似乎不起作用。

这是我想要的:

Padding between bullet and text

这是我目前得到的:

Currently



 <style type="text/css"> html {
   font-family: Verdana;
   font-size: 10px;
 }
 h1,
 h2,
 h3 {
   font-family: Verdana;
   font-weight: bold;
 }
 h1 {
   font-size: 12px;
 }
 h2 {
   font-size: 11px;
 }
 h3 {
   font-size: 10px;
   position: relative;
   left: -20px;
 }
 ol li {
   padding-left: 10px;
 }
 </style>
&#13;
<li>
  Licensee Primary Contact Information
  <ol type="a">
    <li>Name: hkj</li>
    <li>Job Title: hkjhkjhkjh</li>
    <li>Mailing Address: kjhhkj</li>
    <li>
      Direct Telephone Number: hkjh</li>
    <li>Email Address: k</li>
    <li>Web Address: jhk
    </li>
  </ol>
</li>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

&#13;
&#13;
li{
text-indent: 125px;
}
&#13;
<li>
  Licensee Primary Contact Information
  <ol type="a">
    <li>Name: hkj</li>
    <li>Job Title: hkjhkjhkjh</li>
    <li>Mailing Address: kjhhkj</li>
    <li>
      Direct Telephone Number: hkjh</li>
    <li>Email Address: k</li>
    <li>Web Address: jhk
    </li>
  </ol>
</li>
&#13;
&#13;
&#13;

有点夸张但只是为了说明一点,填充是整个li这包括子弹,所以你必须使用text-indent

修改

也许可以尝试将div作为孩子插入并margin-left给孩子div

&#13;
&#13;
li .child{
margin-left: 120px;
}
&#13;
    <li>
      Licensee Primary Contact Information
      <ol type="a">
        <li>Name: hkj</li>
        <li>Job Title: hkjhkjhkjh</li>
        <li>Mailing Address: kjhhkj</li>
        <li><div class="child">Direct Telephone Number: hkjh</div></li>
        <li>Email Address: k</li>
        <li>Web Address: jhk
        </li>
        <li><div class="child">Direct Telephone Number: hkjh</div></li>
        <li><div class="child">Direct Telephone Number: hkjh</div></li>
      </ol>
    </li>
&#13;
&#13;
&#13;