我试图更改从cvs文件导入的文本的字体大小和颜色,我该怎么办?我所有的尝试都失败了。
这是HTML / PHP:
<div id='body'>
<div id='weeeeeeweeeeeee'>
<?php
echo "<html><body><table>\n\n";
$f = fopen("woooopwooop.csv", "r");
while (($line = fgetcsv($f)) !== false) {
echo "<tr>";
foreach ($line as $cell) {
echo "<td>" . htmlspecialchars($cell) . "</td>";
}
echo "</tr>\n";
}
fclose($f);
echo "\n</table></body></html>";
?>
</div
</div>
这是CSS:
body {
font-size:500px;
color:red;
background-position:center;
background-image: url(BearBack1.jpg);
background-repeat: no-repeat;
}
.bodytext p {
font-size:22px;
}
P.blocktext {
margin-left: auto;
margin-right: auto;
width: 6em
}
#weeeeeeweeeeeee{
color:white;
height:400px;
width:500px;
position:relative;
margin-left: auto;
margin-right: auto;
margin-top:250px;
margin-bottom:auto;
}
我可以在Body div中将文本更改为红色但我似乎无法改变其大小。
答案 0 :(得分:1)
因此,如果我正确理解您的PHP代码,它将设置为读取并将csv文件呈现为表格,因此它看起来应该是这样的。
我也在这里猜测,但这会假设你要改变的是td标签中的字体,所以你应该看到我已经添加了一些css效果。
#weeeeeeweeeeeee td {
font-size: 500px;
font-family: Arial;
color: red;
}
&#13;
<div id="body">
<div id="weeeeeeweeeeeee">
<html><body><table>
<tr>
<td>One</td>
<td>Two</td>
<td>Three</td>
</tr>
</table></body></html>
</div>
</div>
&#13;
希望这有帮助。
答案 1 :(得分:1)
尝试让它看起来像这样:
<div id='body'>
Some Red text before the white one
<div id='weeeeeeweeeeeee'>
<table>
<tr>
<td>Your Stuff</td>
</tr>
</table>
</div>
</div>
实际上是这样的(在最后一个div结束标记之前的那个中使用了clossing括号):
<html>
<body>
<div id='body'>
Some Red text before the white one
<div id='weeeeeeweeeeeee'>
<?php
echo "<table>\n\n";
$f = fopen("woooopwooop.csv", "r");
while (($line = fgetcsv($f)) !== false) {
echo "<tr>";
foreach ($line as $cell) {
echo "<td>" . htmlspecialchars($cell) . "</td>";
}
echo "</tr>\n";
}
fclose($f);
echo "\n</table>";
?>
</div>
</div>
<body>
<html>
DIV中的HTMML和BODY标签刚搞砸了,