[英]Table not fit to size screen width
Screenshot: 截图:
I tried to display HTML with UIWebView
for an iOS project, but as you can see from the above image, the TD
is not fit to the screen's width. 我尝试使用iOS项目的
UIWebView
显示HTML,但是从上图可以看到, TD
不适合屏幕的宽度。 I tried the HTML source with a browser and it is working well, but in mobile it doesn't. 我使用浏览器尝试了HTML源,并且运行良好,但是在移动设备中却无法运行。
What do I need to make the table fit exactly to the screen? 我需要什么来使桌子完全适合屏幕?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
body {
font: 9pt tahoma, sans-serif;
direction:rtl;
}
*
{
margin: 0px;
padding: 0px;
}
html, body
{
height: 100%;
}
#print-header {
width:95%;
margin:10px auto 10px auto;
/*
background-image:url('../../icon/logo.png');
background-repeat:no-repeat;
background-position:left top;
*/
}
#print-header table {
border-collapse: collapse;
border:0;
margin:10px auto 10px auto;
text-align: center;
width:100%;
/*border:1px solid black;*/
}
#print-header .key {
text-align: left;
}
#print-header .value {
text-align: right;
/*font-weight:bold;*/
}
#print-header th {
border:0;
text-align: right;
width:50%;
/*background:red;*/
}
#print-header td {
border:0;
}
#print-body table{
border-collapse: collapse;
border:1px solid black;
margin:20px auto 20px auto;
text-align: center;
width:200%;
white-space: nowrap;
}
#print-body thead {
font-weight:bold;
}
#print-body th{
border:1px solid black;
padding:2px;
}
#print-body td{
border:1px solid black;
padding:2px;
}
#print-footer {
text-align: center;
font-size:13px
}
#print-body #print-caption {
text-align: center;
font-weight: bold;
font-size: small;
padding: 40px 0 30px 0;
}
</style>
</head>
<body>
<div >
<table>
<tr>
<th rowspan="2" align=right><img border="0" src=".../img.png"></th>
</tr>
</table>
</div>
<div id="print-body">
<hr size="4px" style="background-color:black">
<table cellspacing="0" cellpadding="0">
<tr>
<td width="100%">ISSUE DATE</td>
</tr>
</table>
</div>
<hr size="4px" style="background-color:black">
<div id="print-footer">
<p>sassas<br>asassasa</p>
</div>
</body>
</html>
尝试表格witdh:100%和位置:固定
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.