为什么我在浏览器中查看此文件时会显示我的html标签?

时间:2013-10-23 01:21:14

标签: html

标题几乎说明了一切。我认为它格式正确,但由于某种原因,我仍然看到用浏览器打开时的标签。对代码墙感到抱歉,我很确定问题非常简单,但现在最容易复制和粘贴整个问题。

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta http-equiv="Content-Style-Type" content="text/css">
  <title></title>
  <meta name="Generator" content="Cocoa HTML Writer">
  <meta name="CocoaVersion" content="1038.36">
  <style type="text/css">
    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
    p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
    span.Apple-tab-span {white-space:pre}
  </style>
</head>
<body>
<p class="p1">&lt;html xmlns="http://www.assignment9.com/xhtml"&gt;</p>
<p class="p1">&lt;head&gt; &lt;title&gt;James&lt;/title&gt; &lt;/head&gt;</p>
<p class="p2"><br></p>
<p class="p1">&lt;body style="background-color : black; color : white"&gt;</p>
<p class="p1"><span class="Apple-tab-span"> </span>&lt;h1&gt;Musical background&lt;/h1&gt;</p>
<p class="p1">&lt;p&gt;James has had a rich musical background.<span class="Apple-converted-space">  </span>He started playing the upright bass at 10 years old.<span class="Apple-converted-space">  </span>From there he moved to the electric bass at 13 and guitar at 15.<span class="Apple-converted-space">  </span>Guitar is his true love and calling.<span class="Apple-converted-space">  </span>James has been self taught on guitar for 8 years and is now gigging fairly often in the hartford area. &lt;/p&gt;</p>
<p class="p2"><br></p>
<p class="p1"><span class="Apple-tab-span"> </span>&lt;h2&gt;James' Favorite Musical Groups&lt;/h2&gt;</p>
<p class="p1">&lt;p&gt;With all the genre's of music out there, James has been influenced by bands and artists from several genre's including, The Eagles, Van Halen, Brad Paisley, Europe, Joe Bonamassa.<span class="Apple-converted-space">  </span>&lt;/p&gt;</p>
<p class="p2"><br></p>
<p class="p1">&lt;img src="IMG_0123" alt="PRS Santana SE/&gt;</p>
<p class="p2"><br></p>
<p class="p1"><span class="Apple-tab-span"> </span>&lt;h3&gt;Musical Instruments&lt;/h3&gt;</p>
<p class="p1">&lt;p&gt;James currently 4 guitars and he loves each and everyone one of them.<span class="Apple-converted-space">  </span>His first guitar was a Fender Stratocaster.<span class="Apple-converted-space">  </span>It served as his only electric guitar until earlier this year when he purchased a PRS Santana SE.<span class="Apple-converted-space">  </span>This is now his primary electric guitar.<span class="Apple-converted-space">  </span>For acoustic guitars, has a Takemine G Series acoustic electric guitar and a Breedlove 514CE acoustic electric guitar.<span class="Apple-converted-space">  </span>He frequently is seen giggling with both guitars&lt;/p&gt;</p>
<p class="p2"><br></p>
<p class="p1">&lt;/body&gt;</p>
<p class="p1">&lt;/html&gt;</p>
</body>
</html>

2 个答案:

答案 0 :(得分:2)

看起来您使用Cocoa HTML编写器,但将HTML粘贴到Visual(WYSIWYG)编辑器中。这个问题是它用html编码的等价物编码你的所有标签(例如&amp; gt;) 如果此软件具有HTML /源视图,请尝试将内容粘贴到那里,然后保存。

如果没有将内容粘贴到不进行html格式化的普通文本编辑器中,然后使用.html扩展名保存文件。

如果您不确定如何提取原始HTML代码,请删除&lt; p&gt;标签,然后将文本复制到以下网站:http://www.opinionatedgeek.com/DotNet/Tools/HTMLEncode/decode.aspx

答案 1 :(得分:0)

您的问题是HTML中的内容是HTML实体。 &lt;与文字&lt;和&gt;与&gt;相同所以,它正确地格式化你的HTML,但你的内容看起来就像HTML。

以下是HTML实体的链接:http://www.w3schools.com/html/html_entities.asp

相关问题