Выровнять изображение заголовка слева в таблице БЕЗ абсолютного позиционирования? - PullRequest
0 голосов
/ 20 августа 2010

Я экспортирую html в pdf и использую свойства thead и tfoot таблицы для создания верхних и нижних колонтитулов страниц в моем выводе pdf. Это работает довольно хорошо, за исключением того, что мне нужно изображение в левом верхнем углу каждой страницы. Использование position: absolute в качестве тега на изображении работает в формате html, но, к сожалению, сторонним экспортером pdf игнорируется. Это отталкивает весь мой текст от высоты изображения, вместо того, чтобы приятно сидеть рядом с ним. Есть ли способ сделать это с помощью другого метода в CSS? Вот часть кода:

<table>
   <thead>
      <tr>
         <td><img src="mypic.jpg" style="height:150px; width:50px;" alt="pic" /></td>
         <td>&nbsp;</td>
      <tr>
   </thead>
   <tfoot>
      <tr>
         <td colspan="2" style="border-bottom-style:solid; padding-top:10px">blah blah blah</td>
         <td colspan="2" align="right">todays date</td>
      </tr>
   </tfoot>
   <colgroup><col width="50px" /><col width="500px" /></colgroup>
   <tbody>
      <tr>
         <td>&nbsp;</td>
         <td>
             ....my real content...
         </td>
      </tr>
   </tbody>
</table>

1 Ответ

0 голосов
/ 20 августа 2010

Попробуйте это -Здесь важно выровнять по тегу изображения по левому краю, и изображение будет перемещено в строку содержимого.

<table>
    <tfoot>
        <tr>
            <td colspan="2" style="border-bottom-style: solid; padding-top: 10px;">
                blah blah blah
            </td>
            <td colspan="2" align="right">
                todays date
            </td>
        </tr>
    </tfoot>
    <colgroup>
        <col width="50px">
        <col width="500px">
    </colgroup>
    <tbody>
        <tr>
            <td>
                &nbsp;
            </td>
            <td>
                <div>
                    <img src="mypic.jpg" style="height: 150px; width: 50px;" alt="pic" align="left"><p>
                        this is some contentthis is some contentthis is some contentthis is some contentthis
                        is some contentthis is some contentthis is some contentthis is some contentthis
                        is some content this is some contentthis is some contentthis is some contentthis
                        is some contentthis is some contentthis is some contentthis is some contentthis
                        is some contentthis is some content this is some contentthis is some contentthis
                        is some contentthis is some contentthis is some contentthis is some contentthis
                        is some contentthis is some contentthis is some content this is some contentthis
                        is some contentthis is some contentthis is some contentthis is some contentthis
                        is some contentthis is some contentthis is some contentthis is some content this
                        is some contentthis is some contentthis is some contentthis is some contentthis
                        is some contentthis is some contentthis is some content</p>
                </div>
            </td>
        </tr>
    </tbody>
</table>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...