如何在HTML中设置的固定宽度[英]how to set fixed width for in HTML 本文翻译自  Rishabh Gusain  查看原文  2015-05-03  165    css/

时间:2022-11-03 11:35:35

I am trying to use table element to align text to print to A4 page using the plain HTML i got perfect alignment which prints perfectly in a paper but when printing another name td is resized and i lose paper alignment as i have tapleted paper with fields like name already printed so i need right aligment so it would print in the same section on the paper. any solution for this?

我试图用表格元素对齐文字打印到A4页面使用的纯HTML我完美对齐打印完美的一篇论文中但当印刷另一个名字td的大小和我输纸对齐tapleted纸等字段的名字已经打印所以我需要正确的线条将打印在相同的部分在纸上。任何解决方案吗?

<table width = 100% border =1>      
<tr>
            <td>&nbsp;&nbsp;&nbsp;&nbsp;</td> 
            <td>&nbsp;&nbsp;&nbsp;&nbsp;</td> 
            <td align = "right"><my><?php echo $name;?></my></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;&nbsp;</td>
            <td align = "center"><my><?php echo $rollno;?></my></td>
            <td>&nbsp;</td>         
            <td>&nbsp;&nbsp;</td>
</tr></table>

1 个解决方案

#1


4  

You can set table-layout: fixed property for table element and width: ? (where ? stands for the width value you want to provide) for your td element.

你可以设置表格布局:固定属性为表格元素和宽度:?(在哪里?代表您想要提供的宽度值)为您的td元素。

By the way, html attribute value should be always enclosed with quotes, for example: border="1".

顺便说一下,html属性值应该始终包含引号,例如:border="1"。

#1


4  

You can set table-layout: fixed property for table element and width: ? (where ? stands for the width value you want to provide) for your td element.

你可以设置表格布局:固定属性为表格元素和宽度:?(在哪里?代表您想要提供的宽度值)为您的td元素。

By the way, html attribute value should be always enclosed with quotes, for example: border="1".

顺便说一下,html属性值应该始终包含引号,例如:border="1"。