我正在使用cshtml编码网页,该网页具有指向Windows服务器位置中doc或pdf文件的链接。在Windows资源管理器中,我可以通过单击链接打开文件。但是在chrome或mozilla中,我无法打开文件。在SO中搜索后,我了解到出于安全原因无法在chrome或firefox中打开本地文件。
我对此还可以。但是问题是页面布局在Internet Explorer 11或8中无法正确显示。
这是我的代码:
@{
var dataFile = Server.MapPath("~/App_Data/Issues.txt");
Array userData = File.ReadAllLines(dataFile);
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css\styles.css">
</head>
<body>
<table width="1084" border="0">
<tr>
<td align="center"><h1><strong> Bug Analysis Helper Tool</strong></h1></td>
</tr>
</table>
<table class="abc" width="1085" height="464" border="0">
<tr id=abc>
<td width="139" valign=top >Shows how to approach an issue</td>
<td width="936" rowspan="2" valign=top>
<h2>Types of Issues</h2>
@foreach (string dataLine in userData)
{
int i = 0;
string[] words = dataLine.Split(',');
string[] a = new string[2];
foreach (string dataItem in words)
{
a[i] = @dataItem;
i++;
}
<a href="@a[1]"> @a[0] </a> <br/>
}
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
CSS:
table.abc
{
color: #FFFFFF;
font-family: Verdana, Arial, Helvetica;
font-size: 78pt;
font-weight:bold;
font-style: normal;
font-variant: normal;
text-indent: 10px;
background-color:#000000;
}
body
{
background-color: #FFFFFF;
font-family: Verdana, Arial, Helvetica;
font-size: 9pt;
font-weight: normal;
font-style: normal;
font-variant: normal;
color: #000000;
}
p
{
color: #000000;
font-family: Verdana, Arial, Helvetica;
font-size: 9pt;
font-weight: normal;
font-style: normal;
font-variant: normal;
text-indent: 20px;
}
h1
{
color: #000099;
font-family:Segoe UI, Arial, Times New Roman;
font-size: 26pt;
font-weight: bold;
font-style: oblique;
font-variant: normal;
text-indent: 10px;
}
h2
{
color: #FF6600;
font-family: Verdana, Arial, Helvetica;
font-size: 20pt;
font-weight: bold;
font-style: italic;
font-variant: normal;
text-indent: 10px;
}
td
{
background-color: #FFFFFF;
font-family: Verdana, Arial, Helvetica;
font-size: 9pt;
font-weight: normal;
font-style: normal;
font-variant: normal;
color: #000000;
}
th
{
background-color: #FFFFFF;
font-family: Verdana, Arial, Helvetica;
font-size: 9pt;
font-weight: bold;
font-style: normal;
font-variant: normal;
color: #000000;
}
(不要尝试使用其他版本的IE)
最佳答案
为所有标签宽度指定单位,如下所示。
<table width="1084px" border="0">