【发布时间】:2020-01-13 03:49:12
【问题描述】:
我试图让我的文本文件在通过 php 输出时正确设置样式。
我在 index.html 中的代码是:
<?php include 'read.php'?>
<style>
#text{
height:80%;
}
</style>
在 read.php 我有:
<?php
$txt = file_get_contents( "2020-1-12 19:36:35.txt" );
echo "<span style='height:80%;'>".$txt. "</span>";
?>
当我用 google DevTools 看这个时,我发现我的文本,即使在 span/div 元素内,它也不会继承属性,所以只是以直线输出,而不是像我想要的那样使用新行它(它在文本文件中的样子,以及它在 DevTools 中的显示方式)。见下图。在 DevTools 中,这就是我希望它在 index.html 中输出的方式。
输出为:Student has 1 minutes left on their account. (Tutor) [00:00:06] : asdf a (Tutor) [00:00:06] : sd fa (Tutor) [00:00:06] : sdfasd (Tutor) [00:00:07] : f ew (Tutor) [00:00:07] : rfew f (Tutor) [00:00:07] : as e 全部在一行(见下文)
【问题讨论】:
标签: javascript php html css