页面显示代码未呈现 [英] Page shows code not rendering

查看:83
本文介绍了页面显示代码未呈现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这是一个简单的问题,但我为此奋斗了几个小时,因此最好在论坛上寻求帮助.我在TextEdit程序中添加了以下简单的html代码段,并将文件另存为webpage(.html).当我在任何浏览器(例如safari,chrome或firefox)中运行此文件时,它会在其中显示相同的代码,而不是将其呈现为网页.

I know this is simple question, but i am fighting with it for few hrs, so its better to ask in forum to get help quickly. I have added the following simple html snippet in a TextEdit program and saved the file as webpage(.html). When I run this file in any browser, like safari, chrome or firefox, it shows the same code there instead of rendering this as web page.

<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>

有人可以帮助我将其显示为真实的网页,而不显示源代码吗?

Could someone help me to show this as real web page rather than source code showing?

推荐答案

TextEdit 已格式化,因为将文本另存为Web文档认为您已经按照所有格式而不是原始HTML代码键入了想要显示的网页.尝试将文档另存为原始文本,然后手动将扩展名从扩展名(可能为.txt)更改为.html.对于更永久的解决方案,建议在编码时使用非格式文本编辑器.

It is likely that TextEdit has formatted your text, since by saving it as a Web Document it thinks that you have typed up the web page how you want it displayed, with all formatting, instead of raw HTML code. Try to save the document as raw text, then change the extension manually from whatever it is (probably .txt) to .html. For a more permanent solution, it is advisable to use a non-formatting text editor when coding.

这就是Apple所说的: http://support.apple.com/kb/ta20406

This is what Apple have to say: http://support.apple.com/kb/ta20406

这篇关于页面显示代码未呈现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆