2013-05-25 176 views
1

我很善於學習,我使用W3驗證器來檢查我的代碼。 現在,我得到這個文件,它加載:html內部的html標題html內容

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<link href="main.css" rel="stylesheet" type="text/css"> 
</head> 
<body> 

<?php 
include("menu.php"); 
?> 

<?php 
if (is_file("$file.inc.php")) include ("$file.inc.php"); 
else include("homepage.inc.php"); 
?> 

</body> 
</html> 

在您選擇例如「第一個」菜單,然後負載,因爲其中含有「pageA.inc.php」:

<title>SUPERAWESOME TITLE of page A</title> 
text text text 
... 

它工作正常,但我得到的這一套在W3驗證錯誤的,我不知道如何處理:

  1. 在第一組的代碼:結束標記未完成的「頭」,不包含「TITLE」
  2. 在第二組代碼:文件類型不允許元素「TITLE」這裏

如果我在第一組代碼設置標題,首先要解決的問題,它總是讓我發現,相同的標題。 如果我在第二組代碼中設置標籤,我會在W3驗證程序中得到更多的錯誤,說它不允許在那裏。

我該如何解決這個問題? 或者我應該不在乎?它現在正在以它應該的方式工作,在驗證時我只是被錯誤所困擾。

+0

這是上添加titlehead正確的,是的,''應該去'<head>內' ,而不是'<body>'。就是這樣。標題是關於html文件的信息的一部分,而不是內容的一部分。所以把標題放在'<head>'和'</head>'之間。 – <span class="text-secondary"> <small> <span></span> </small> </span> </p> </div> </div> </div> <div itemprop="comment" class="post-comment"> <div class="row"> <div class="col-lg-1"><span class="text-secondary">+0</span></div> <div class="col-lg-11"> <p class="commenttext">使用HTML4的具體原因是什麼?或者ISO-8859。 – <span class="text-secondary"> <small> <a rel="noopener" target="_blank" href="https://stackoverflow.com/users/502381/">JJJ</a></span> <span></span> </small> </span> </p> </div> </div> </div> <div itemprop="comment" class="post-comment"> <div class="row"> <div class="col-lg-1"><span class="text-secondary">+0</span></div> <div class="col-lg-11"> <p class="commenttext">@Juhana和HTML 4出了什麼問題?或者ISO-8859-1。 – <span class="text-secondary"> <small> <span></span> </small> </span> </p> </div> </div> </div> </div> </div> </article> </div> <div class="answer-title"> <span class="text-logo margin-top-sm">A</span> <h2 class="title h4">回答</h2> </div> <div class="item-description text-md markdown-body margin-bottom-40 voidso"> <article class="board-top-1 padding-top-10"> <div class="post-col vote-info"> <span class="count">0<i class="fa fa-thumbs-up"></i></span> <i class="fa fa-check fa-2x"></i> </div> <div class="post-offset"> <div class="answer fmt"> <p>您正在將您的標題寫入您的html正文,並且這是無效的。標題應在頭部,e.g:</p> <pre><code class="prettyprint-override"><head> <!-- other head tags --> <title>Your Title</title> </head> </code></pre> <p>你可以做的還包括在你的腦袋部分:</p> <pre><code class="prettyprint-override">if (is_file("$file.inc.php")) include ("$file.header.inc.php"); </code></pre> <p>而在你INC文件只是輸出<code class="prettyprint-override"><title>...</title></code>。然後在正文部分中可以包含另一個帶有文本輸出的文件,那麼您的html標記應該是有效的。</p> </div> <div class="post-info"> <div class="post-meta row"> <p class="text-secondary col-lg-6"> <span class="source"> <a rel="noopener" target="_blank" href="https://stackoverflow.com/q/16751102">來源</a> </span> </p> <p class="text-secondary col-lg-6"> <span class="float-right date"> <span>2013-05-25 15:34:37</span> <a rel="noopener" target="_blank" href="https://stackoverflow.com/users/2039482/">bpoiss</a></span> </p> <p class="col-12"></p> <p class="col-12"></p></div> </div> <!-- comments --> <div class="comments"> <div itemprop="comment" class="post-comment"> <div class="row"> <div class="col-lg-1"><span class="text-secondary">+0</span></div> <div class="col-lg-11"> <p class="commenttext">但標題應該取決於哪個文件在裏面打開。 如果我在第二組代碼中設置標籤,我會在W3驗證程序中得到更多的錯誤,說它不允許使用它。 – <span class="text-secondary"> <small> <a rel="noopener" target="_blank" href="https://stackoverflow.com/users/2420521/">Selkis</a></span> <span></span> </small> </span> </p> </div> </div> </div> <div itemprop="comment" class="post-comment"> <div class="row"> <div class="col-lg-1"><span class="text-secondary">+0</span></div> <div class="col-lg-11"> <p class="commenttext">例如爲每個文件創建2包括文件,一個開始'header.'然後執行'如果(is_file( 「$ file.inc.php」))包括( 「$ file.header.inc.php」); ' – <span class="text-secondary"> <small> <a rel="noopener" target="_blank" href="https://stackoverflow.com/users/2039482/">bpoiss</a></span> <span></span> </small> </span> </p> </div> </div> </div> <div itemprop="comment" class="post-comment"> <div class="row"> <div class="col-lg-1"><span class="text-secondary">+0</span></div> <div class="col-lg-11"> <p class="commenttext">謝謝,這工作! 還有一個問題,是否值得讓10個以上的文件包含頁面的標題,以便僅在W3上發生錯誤;但無論如何工作? – <span class="text-secondary"> <small> <a rel="noopener" target="_blank" href="https://stackoverflow.com/users/2420521/">Selkis</a></span> <span></span> </small> </span> </p> </div> </div> </div> </div> </div> </article> <div> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-6208739752673518" data-ad-slot="1038284119" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <article class="board-top-1 padding-top-10"> <div class="post-col vote-info"> <span class="count">0<i class="fa fa-thumbs-up"></i></span> </div> <div class="post-offset"> <div class="answer fmt"> <p>你可以試試這樣 你缺少<code class="prettyprint-override">end tag</code>爲<code class="prettyprint-override">meta</code>,你需要基於當前頁</p> <pre><code class="prettyprint-override"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <?php include("title.php"); ?> <link href="main.css" rel="stylesheet" type="text/css"> </head> <body> <?php include("menu.php"); ?> <?php if (is_file("$file.inc.php")) include ("$file.inc.php"); else include("homepage.inc.php"); ?> </body> </html> </code></pre> </div> <div class="post-info"> <div class="post-meta row"> <p class="text-secondary col-lg-6"> <span class="source"> <a rel="noopener" target="_blank" href="https://stackoverflow.com/q/16751133">來源</a> </span> </p> <p class="text-secondary col-lg-6"> <span class="float-right date"> <span>2013-05-25 15:36:58</span> <a rel="noopener" target="_blank" href="https://stackoverflow.com/users/1435068/">sAnS</a></span> </p> <p class="col-12"></p> <p class="col-12"></p></div> </div> </div> </article> </div> <div class="clearfix"> </div> <div class="relative-box"> <div class="relative">相關問題</div> <ul class="relative_list"> <li> 1. <a href="http://hk.uwenku.com/question/p-riixbepu-ps.html" target="_blank" title="HTML內部HTML與HTML標籤"> HTML內部HTML與HTML標籤 </a> </li> <li> 2. <a href="http://hk.uwenku.com/question/p-dvulvhlb-rq.html" target="_blank" title="HTML內容中的HTML"> HTML內容中的HTML </a> </li> <li> 3. <a href="http://hk.uwenku.com/question/p-qkwslmsk-bhe.html" target="_blank" title="內容與html中的標題重疊"> 內容與html中的標題重疊 </a> </li> <li> 4. <a href="http://hk.uwenku.com/question/p-fvofhlob-bbb.html" target="_blank" title="內容中的HTML標記"> 內容中的HTML標記 </a> </li> <li> 5. <a href="http://hk.uwenku.com/question/p-oqcufmbw-ny.html" target="_blank" title="如何使用BeautifulSoup解析HTML標籤內部的HTML標籤的內容?"> 如何使用BeautifulSoup解析HTML標籤內部的HTML標籤的內容? </a> </li> <li> 6. <a href="http://hk.uwenku.com/question/p-rphdefme-bgv.html" target="_blank" title="獲取html標籤內/ html標籤之間的所有內容"> 獲取html標籤內/ html標籤之間的所有內容 </a> </li> <li> 7. <a href="http://hk.uwenku.com/question/p-khauwrdl-ww.html" target="_blank" title="HTML內容部分解析"> HTML內容部分解析 </a> </li> <li> 8. <a href="http://hk.uwenku.com/question/p-yfdiifyu-yc.html" target="_blank" title="解析HTML內容和HTML"> 解析HTML內容和HTML </a> </li> <li> 9. <a href="http://hk.uwenku.com/question/p-rlhstplm-hb.html" target="_blank" title="jquery .html()刪除html內容"> jquery .html()刪除html內容 </a> </li> <li> 10. <a href="http://hk.uwenku.com/question/p-ugooruhk-bkz.html" target="_blank" title="Drupal主題與HTML內容"> Drupal主題與HTML內容 </a> </li> <div> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block; text-align:center;" data-ad-layout="in-article" data-ad-format="fluid" data-ad-client="ca-pub-6208739752673518" data-ad-slot="4606349252"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <li> 11. <a href="http://hk.uwenku.com/question/p-tvedbkjh-bcc.html" target="_blank" title="刪除HTML標記+內容"> 刪除HTML標記+內容 </a> </li> <li> 12. <a href="http://hk.uwenku.com/question/p-ymoboomk-bhr.html" target="_blank" title="替換HTML標籤內容"> 替換HTML標籤內容 </a> </li> <li> 13. <a href="http://hk.uwenku.com/question/p-qcijmega-bem.html" target="_blank" title="JSON.parse Html內容"> JSON.parse Html內容 </a> </li> <li> 14. <a href="http://hk.uwenku.com/question/p-doxoibsz-bod.html" target="_blank" title="包HTML內容"> 包HTML內容 </a> </li> <li> 15. <a href="http://hk.uwenku.com/question/p-wnjnhwif-dk.html" target="_blank" title="HTML內容"> HTML內容 </a> </li> <li> 16. <a href="http://hk.uwenku.com/question/p-wyxmcbbx-ue.html" target="_blank" title="HTML iFrame內容"> HTML iFrame內容 </a> </li> <li> 17. <a href="http://hk.uwenku.com/question/p-hprrcptt-bcs.html" target="_blank" title="獲取標籤內的全部內容,包括html標籤"> 獲取標籤內的全部內容,包括html標籤 </a> </li> <li> 18. <a href="http://hk.uwenku.com/question/p-horobfqj-kg.html" target="_blank" title="PHP內部HTML問題"> PHP內部HTML問題 </a> </li> <li> 19. <a href="http://hk.uwenku.com/question/p-oehybalk-bbg.html" target="_blank" title="look_down檢查(內部HTML)內容"> look_down檢查(內部HTML)內容 </a> </li> <li> 20. <a href="http://hk.uwenku.com/question/p-hgcjvnbc-bdk.html" target="_blank" title="訪問內部html標記"> 訪問內部html標記 </a> </li> <li> 21. <a href="http://hk.uwenku.com/question/p-krbinixa-bdu.html" target="_blank" title="HTML內容的jQuery"> HTML內容的jQuery </a> </li> <li> 22. <a href="http://hk.uwenku.com/question/p-zqivzfso-cp.html" target="_blank" title="YouTube的HTML內容"> YouTube的HTML內容 </a> </li> <li> 23. <a href="http://hk.uwenku.com/question/p-edejhfzk-gc.html" target="_blank" title="jQuery的HTML內容"> jQuery的HTML內容 </a> </li> <li> 24. <a href="http://hk.uwenku.com/question/p-dwlsqknl-gp.html" target="_blank" title="xml內部html"> xml內部html </a> </li> <li> 25. <a href="http://hk.uwenku.com/question/p-zkwxnsoi-bdv.html" target="_blank" title="php內部html"> php內部html </a> </li> <li> 26. <a href="http://hk.uwenku.com/question/p-ntmhwnvi-bhb.html" target="_blank" title="在html body標籤內添加內容"> 在html body標籤內添加內容 </a> </li> <li> 27. <a href="http://hk.uwenku.com/question/p-phmmrdxf-po.html" target="_blank" title="在標籤內嵌入HTML內容?"> 在標籤內嵌入HTML內容? </a> </li> <li> 28. <a href="http://hk.uwenku.com/question/p-nbyndysm-bcv.html" target="_blank" title="html內部的jQuery"> html內部的jQuery </a> </li> <li> 29. <a href="http://hk.uwenku.com/question/p-rwqwyugu-nb.html" target="_blank" title="jQuery的內部HTML"> jQuery的內部HTML </a> </li> <li> 30. <a href="http://hk.uwenku.com/question/p-xvjxgfmr-bcn.html" target="_blank" title="webView內部的HTML"> webView內部的HTML </a> </li> </ul> </div> <div> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-6208739752673518" data-ad-slot="1575177025"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <div class="padding-top-10"></div> </div> </div> <script type="text/javascript" src="http://img.uwenku.com/uwenku/script/side.js?t=1644592048261"></script> <script type="text/javascript" src="http://img.uwenku.com/uwenku/plugin/highlight/highlight.pack.js"></script> <link href="http://img.uwenku.com/uwenku/plugin/highlight/styles/docco.css" media="screen" rel="stylesheet" type="text/css" /> <script type="text/javascript"> $('pre').each(function(i, e) { hljs.highlightBlock(e, "<span class='indent'> </span>", false) }); </script> <div class="col-lg-3 col-md-4 col-sm-5"> <div id="rightTop"> <div class="row"> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-6208739752673518" data-ad-slot="5415218910" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <div class="row sidebar panel panel-default"> <div class="panel-heading font-bold"> 最新問題 </div> <div class="m-b-sm m-t-sm clearfix"> <ul class="side_article_list"> <li class="side_article_list_item"> 1. <a href="http://hk.uwenku.com/question/p-wszjnyuy-d.html" target="_blank" title="標籤變量循環"> 標籤變量循環 </a> </li> <li class="side_article_list_item"> 2. <a href="http://hk.uwenku.com/question/p-qyjrkuqo-cc.html" target="_blank" title="是不是將屬性設置爲等於有效的HTML值?"> 是不是將屬性設置爲等於有效的HTML值? </a> </li> <li class="side_article_list_item"> 3. <a href="http://hk.uwenku.com/question/p-rcmymcwv-bmd.html" target="_blank" title="如何實現全局密鑰監聽器?"> 如何實現全局密鑰監聽器? </a> </li> <li class="side_article_list_item"> 4. <a href="http://hk.uwenku.com/question/p-oluxqrwc-bkr.html" target="_blank" title="Laravel 5廣播事件到通配符通道使用節點和Laravel ECHO-服務器"> Laravel 5廣播事件到通配符通道使用節點和Laravel ECHO-服務器 </a> </li> <li class="side_article_list_item"> 5. <a href="http://hk.uwenku.com/question/p-pwfrxlsb-bdt.html" target="_blank" title="選擇默認類型要下載"> 選擇默認類型要下載 </a> </li> <li class="side_article_list_item"> 6. <a href="http://hk.uwenku.com/question/p-ncdnnkbo-bep.html" target="_blank" title="如何使用正確的列名將文本分隔爲列"> 如何使用正確的列名將文本分隔爲列 </a> </li> <li class="side_article_list_item"> 7. <a href="http://hk.uwenku.com/question/p-hctoaoej-beg.html" target="_blank" title="Inno Setup [設置] 64bit條件"> Inno Setup [設置] 64bit條件 </a> </li> <li class="side_article_list_item"> 8. <a href="http://hk.uwenku.com/question/p-mkycehfm-bgc.html" target="_blank" title="Linux上的Swift Objective-C互操作性錯誤:找不到'Foundation/Foundation.h'文件"> Linux上的Swift Objective-C互操作性錯誤:找不到'Foundation/Foundation.h'文件 </a> </li> <li class="side_article_list_item"> 9. <a href="http://hk.uwenku.com/question/p-tlgbplif-bev.html" target="_blank" title="的SyntaxError 255李斯特"> 的SyntaxError 255李斯特 </a> </li> <li class="side_article_list_item"> 10. <a href="http://hk.uwenku.com/question/p-ozjhreyu-bgs.html" target="_blank" title="如何在JAVA中使用apache POI在Excel中設置/取消設置列過濾器的值?"> 如何在JAVA中使用apache POI在Excel中設置/取消設置列過濾器的值? </a> </li> </ul> </div> </div> </div> <p class="article-nav-bar"></p> <div class="row sidebar article-nav"> <div class="row box_white visible-sm visible-md visible-lg margin-zero"> <div class="top"> <h3 class="title"><i class="glyphicon glyphicon-th-list"></i> 相關問題</h3> </div> <div class="article-relative-content"> <ul class="side_article_list"> <li class="side_article_list_item"> 1. <a href="http://hk.uwenku.com/question/p-riixbepu-ps.html" target="_blank" title="HTML內部HTML與HTML標籤"> HTML內部HTML與HTML標籤 </a> </li> <li class="side_article_list_item"> 2. <a href="http://hk.uwenku.com/question/p-dvulvhlb-rq.html" target="_blank" title="HTML內容中的HTML"> HTML內容中的HTML </a> </li> <li class="side_article_list_item"> 3. <a href="http://hk.uwenku.com/question/p-qkwslmsk-bhe.html" target="_blank" title="內容與html中的標題重疊"> 內容與html中的標題重疊 </a> </li> <li class="side_article_list_item"> 4. <a href="http://hk.uwenku.com/question/p-fvofhlob-bbb.html" target="_blank" title="內容中的HTML標記"> 內容中的HTML標記 </a> </li> <li class="side_article_list_item"> 5. <a href="http://hk.uwenku.com/question/p-oqcufmbw-ny.html" target="_blank" title="如何使用BeautifulSoup解析HTML標籤內部的HTML標籤的內容?"> 如何使用BeautifulSoup解析HTML標籤內部的HTML標籤的內容? </a> </li> <li class="side_article_list_item"> 6. <a href="http://hk.uwenku.com/question/p-rphdefme-bgv.html" target="_blank" title="獲取html標籤內/ html標籤之間的所有內容"> 獲取html標籤內/ html標籤之間的所有內容 </a> </li> <li class="side_article_list_item"> 7. <a href="http://hk.uwenku.com/question/p-khauwrdl-ww.html" target="_blank" title="HTML內容部分解析"> HTML內容部分解析 </a> </li> <li class="side_article_list_item"> 8. <a href="http://hk.uwenku.com/question/p-yfdiifyu-yc.html" target="_blank" title="解析HTML內容和HTML"> 解析HTML內容和HTML </a> </li> <li class="side_article_list_item"> 9. <a href="http://hk.uwenku.com/question/p-rlhstplm-hb.html" target="_blank" title="jquery .html()刪除html內容"> jquery .html()刪除html內容 </a> </li> <li class="side_article_list_item"> 10. <a href="http://hk.uwenku.com/question/p-ugooruhk-bkz.html" target="_blank" title="Drupal主題與HTML內容"> Drupal主題與HTML內容 </a> </li> </ul> </div> </div> </div> </div> </div> </div> </div><!-- wrap end--> <!-- footer --> <footer id="footer"> <div class="bg-simple lt"> <div class="container"> <div class="row padder-v m-t"> <div class="col-xs-8"> <ul class="list-inline"> <li><a href="http://hk.uwenku.com/contact">聯系我們</a></li> <li>© 2020 HK.UWENKU.COM</li> <li><a target="_blank" href="https://beian.miit.gov.cn/">沪ICP备13005482号-4</a></li> <li><script type="text/javascript" src="https://v1.cnzz.com/z_stat.php?id=1280101193&web_id=1280101193"></script></li> <li><a href="http://www.uwenku.com/" target="_blank" title="优文库">简体中文</a></li> <li><a href="http://hk.uwenku.com/" target="_blank" title="優文庫">繁體中文</a></li> <li><a href="http://ru.uwenku.com/" target="_blank" title="поле вопросов и ответов">Русский</a></li> <li><a href="http://de.uwenku.com/" target="_blank" title="Frage - und - antwort - Park">Deutsch</a></li> <li><a href="http://es.uwenku.com/" target="_blank" title="Preguntas y respuestas">Español</a></li> <li><a href="http://hi.uwenku.com/" target="_blank" title="कार्यक्रम प्रश्न और उत्तर पार्क">हिन्दी</a></li> <li><a href="http://it.uwenku.com/" target="_blank" title="IL Programma di chiedere Park">Italiano</a></li> <li><a href="http://ja.uwenku.com/" target="_blank" title="プログラム問答園区">日本語</a></li> <li><a href="http://ko.uwenku.com/" target="_blank" title="프로그램 문답 단지">한국어</a></li> <li><a href="http://pl.uwenku.com/" target="_blank" title="program o park">Polski</a></li> <li><a href="http://tr.uwenku.com/" target="_blank" title="Program soru ve cevap parkı">Türkçe</a></li> <li><a href="http://vi.uwenku.com/" target="_blank" title="Đáp ứng viên">Tiếng Việt</a></li> <li><a href="http://fr.uwenku.com/" target="_blank" title="Programme interrogation Park">Française</a></li> </ul> </div> </div> </div> </div> </div> </footer> <!-- / footer --> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?f78a970f17b19a79fc477a3378096f29"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> </body> </html>