Javascript獲取標題屬性值

| | | | | | |

HTML

</pre> 標籤定義了網頁的標題。當您將頁面添加到收藏夾列表時,此標題會出現在瀏覽器選項卡欄中。所有網頁都必須包含 <pre class="prettyprint"><title></pre> 標籤。</em></p><p>當您創建網頁時,您必須為該網頁指定標題。例如,假設您正在為當地麵包店的網站創建主頁。您可能希望麵包店的名稱顯示為網頁的標題。</p><p>這就是 HTML <em><pre class="prettyprint"><title></pre></em> 標籤的用武之地. <em>標籤 <pre class="prettyprint"><title></pre></em> 標籤定義了 HTML 文檔的標題,並被放置在網頁的頭部。本教程將通過一個示例介紹 <em><pre class="prettyprint"><title></pre></em> 標籤的重要性以及如何在代碼中使用它。</p><h2> HTML Head Refresher</h2><p>在 HTML 中,<em><head></em> 元素用於存儲 header 元素。這些元素提供有關網頁的附加信息,例如應為網頁顯示的圖標。</p><p><em><head></em> 部分的元素共同描述了有關網頁的關鍵信息一份文件。它們可以將瀏覽器指向文檔中使用的樣式表和腳本(如果使用)。</p><h2>HTML <pre class="prettyprint"><title></pre></h2><p>HTML <em><pre class="prettyprint"> <title></pre></em> 標籤定義了文檔的標題。此標記出現在 <em><head></em> 標記內。這個標籤應該總結一個網頁的目的。你只需要為每頁指定一個<pre class="prettyprint"><title></pre>標籤。</p><p>我們來看看這個標籤的語法:</p> <p><pre class="prettyprint"><title></pre> 標籤有一個開始標籤和一個結束標籤。在這些標籤之間,我們寫了一個網頁的標題。</p> </div>  </div>  </a> </div> <p>我們的<pre class="prettyprint"><title></pre>標籤的文字沒有出現在網頁上。這是因為我們的 <pre class="prettyprint"><title></pre> 標籤包含在 <head> 標籤中,而不是我們網頁上的 <body> 標籤中。</p><p>我們上面的標題很強大,因為它告訴用戶正在查看的確切頁面。我們還指定了站點的名稱,這樣可以避免用戶在視圖中打開多個標題為“主頁”的選項卡時出現混淆。</p><p>標題應該清晰、易於閱讀且不要太長。考慮以下示例標題:</p><ul><li>博客 - Professional Karma</li><li>聯繫 Professional Karma</li><li>Professional Karma 博客</li></ul> <p>所有這些標題都表達了頁面的目的。它不應該太長,因為標題在標籤欄中的空間有限。</p><p><pre class="prettyprint"><title></pre> 標籤支持所有全局屬性,例如在 HTML5 中。所有主要的現代瀏覽器都支持此標籤。標題標籤沒有特定於元素的 HTML 屬性。</p><h2>示例 HTML 標題標籤</h2><p>HTML 標題元素在 <em><head></em> 標籤內定義在 HTML 頁面上。假設我們正在為我們當地的麵包店 Joseph Abrams & Sons 創建一個網頁。我們目前正在構建主頁,我們希望糕點店的名稱出現在網站的標題中。</p><p>我們可以使用以下代碼將頁面標題設置為“<em>Giuseppe Abrams & Figli.</em> ":</p><p>當我們網站的網頁打開時,頁面標題設置為“<em>Joseph Abrams & Sons</em>”。</p> </a> </div> <p>現在假設我們為之前的本地麵包店創建了一個聯繫頁面。我們可以使用標題“<em>Contact | Joseph Abrams & Sons</em>“.這個標題很簡單,也很好地描述了我們網頁的目的。</p><h2>為什麼要使用<pre class="prettyprint"><title></pre>標籤?</h2><p>有一個數字指定文檔標題標籤很重要的原因有很多。</p><p>首先,<em><pre class="prettyprint"><title></pre></em> 標籤在 Web 瀏覽器的標題欄中顯示頁面標題.例如,這個頁面的標題是“<em>HTML Title Tag: A How-To | Python.Engineering</em>。它出現在這個站點的標籤名稱中。</p><p>第二, <em>標籤 <pre class="prettyprint"><title></pre></em> 標籤在網頁被收藏或保存為用戶瀏覽器中的收藏時標記網頁。您指定的標題將自動保存. 如果您沒有為網頁使用合適的標題,用戶可能很難在他們的收藏夾中找到您的頁面。</p><p>搜索引擎依賴於標籤的內容。標題。在 a 中指定的標題標題標籤將是搜索引擎結果頁面 (SERP) 上網頁的標題。SERP 是搜索結果頁面上的條目。</p><p>此外,<em><pre class="prettyprint"> 的內容<title></pre></em>標籤被搜索引擎用來確定網頁的主題。</p><p>所以現在我們知道了<em><pre class="prettyprint"><title></pre></em> 標籤很重要,你可能想知道:如何使用 HTML 標題標籤?我們來回答這個問題。</p><h2>結論</h2><p>T <em><pre class="prettyprint"><title></pre></em> 標籤表示 HTML 文檔的標題。此標題顯示在 Web 瀏覽器的選項卡名稱中。搜索引擎在處理網頁時也使用它來決定標題和主題。</p> </a> </div> <p>本教程通過參考示例介紹了 HTML <em><pre class="prettyprint"><title></pre></em> 標籤的基礎知識。您現在可以作為 HTML 專家開始使用 title 標籤了!</p><p>想了解更多關於 HTML 編碼的知識嗎?查看我們的 <a href="/learn-html/"> HTML 學習指南</a>。本指南包含適合初學者的最佳學習資源和課程列表。和中級開發人員。您還可以找到關於 HTML 主題的最佳書籍。</p>  </div>



                   </div>
                </div>
                <div class="article__right">
                    <div class="hub_ad">
                        <div id="ezoic-pub-ad-placeholder-106">
                          <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9381065361874746"
                               crossorigin="anonymous"></script>
                          <!-- PYE aside NEW -->
                          <ins class="adsbygoogle"
                               style="display:block"
                               data-ad-client="ca-pub-9381065361874746"
                               data-ad-slot="8755532771"
                               data-ad-format="auto"
                               data-full-width-responsive="true"></ins>
                          <script>
                               (adsbygoogle = window.adsbygoogle || []).push({});
                          </script>  
                        </div>                   
                    </div>
                    <div class="shop-aside shop-aside--mt">
                        <h2 class="shop-aside__title">Shop</h2>
                        <div class="shop__items shop__items--column">
                             	
                            <div class="shop__item"><a class="shop__item-link" href="https://python.engineering/learn-programming-in-r-courses/"></a><img class="shop__item-img" src="">
                                <p class="shop__item-name">Learn programming in R: courses</p><span class="shop__item-price">$</span>
                            </div>
                             	
                            <div class="shop__item"><a class="shop__item-link" href="https://python.engineering/best-python-online-courses-for-2022/"></a><img class="shop__item-img" src="">
                                <p class="shop__item-name">Best Python online courses for 2022</p><span class="shop__item-price">$</span>
                            </div>
                             	
                            <div class="shop__item"><a class="shop__item-link" href="https://python.engineering/best-laptop-for-fortnite/"></a><img class="shop__item-img" src="">
                                <p class="shop__item-name">Best laptop for Fortnite</p><span class="shop__item-price">$</span>
                            </div>
                             	
                            <div class="shop__item"><a class="shop__item-link" href="https://python.engineering/best-laptop-for-excel/"></a><img class="shop__item-img" src="">
                                <p class="shop__item-name">Best laptop for Excel</p><span class="shop__item-price">$</span>
                            </div>
                             	
                            <div class="shop__item"><a class="shop__item-link" href="https://python.engineering/best-laptop-for-solidworks/"></a><img class="shop__item-img" src="">
                                <p class="shop__item-name">Best laptop for Solidworks</p><span class="shop__item-price">$</span>
                            </div>
                             	
                            <div class="shop__item"><a class="shop__item-link" href="https://python.engineering/best-laptop-for-roblox/"></a><img class="shop__item-img" src="">
                                <p class="shop__item-name">Best laptop for Roblox</p><span class="shop__item-price">$</span>
                            </div>
                             	
                            <div class="shop__item"><a class="shop__item-link" href="https://python.engineering/best-computer-for-crypto-mining/"></a><img class="shop__item-img" src="">
                                <p class="shop__item-name">Best computer for crypto mining</p><span class="shop__item-price">$</span>
                            </div>
                             	
                            <div class="shop__item"><a class="shop__item-link" href="https://python.engineering/best-laptop-for-sims-4/"></a><img class="shop__item-img" src="http://python.engineering/wp-content/uploads/2022/04/pye-best-laptop-for-sims-4.jpg">
                                <p class="shop__item-name">Best laptop for Sims 4</p><span class="shop__item-price">$</span>
                            </div>
                            
                        </div>
                    </div>

                    <div class="hub_ad">
                        <div id="ezoic-pub-ad-placeholder-106" style="position:sticky; position:-webkit-sticky; top:0; margin-top:10px; z-index: 1000">
                          <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9381065361874746"
                               crossorigin="anonymous"></script>
                          <!-- PYE aside NEW -->
                          <ins class="adsbygoogle"
                               style="display:block"
                               data-ad-client="ca-pub-9381065361874746"
                               data-ad-slot="8755532771"
                               data-ad-format="auto"
                               data-full-width-responsive="true"></ins>
                          <script>
                               (adsbygoogle = window.adsbygoogle || []).push({});
                          </script>  
                        </div>                   
                    </div>


                    <div class="l-questions l-questions--mt">
                        <p class="l-questions__title">Latest questions</p>
                        <div class="l-questions__list">
                       
                        <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/8134602-psycopg2-insert-multiple-rows-with-one-query/"></a>
                            <div class="l-questions__item-tags"><span class="l-questions__item-tag violet">NUMPY</span><span class="l-questions__item-tag yellow">NUMPY</span></div>
                            <p class="l-questions__item-title">psycopg2: insert multiple rows with one query</p>
                            <p class="l-questions__item-answers"><span>12</span> answers</p>
                        </div>
                       
                        <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/3930188-how-to-convert-nonetype-to-int-or-string/"></a>
                            <div class="l-questions__item-tags"><span class="l-questions__item-tag violet">NUMPY</span><span class="l-questions__item-tag yellow">NUMPY</span></div>
                            <p class="l-questions__item-title">How to convert Nonetype to int or string?</p>
                            <p class="l-questions__item-answers"><span>12</span> answers</p>
                        </div>
                       
                        <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/33945261-how-to-specify-multiple-return-types-using-type-hints/"></a>
                            <div class="l-questions__item-tags"><span class="l-questions__item-tag violet">NUMPY</span><span class="l-questions__item-tag yellow">NUMPY</span></div>
                            <p class="l-questions__item-title">How to specify multiple return types using type-hints</p>
                            <p class="l-questions__item-answers"><span>12</span> answers</p>
                        </div>
                       
                        <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/51922480-javascript-error-ipython-is-not-defined-in-jupyterlab/"></a>
                            <div class="l-questions__item-tags"><span class="l-questions__item-tag violet">NUMPY</span><span class="l-questions__item-tag yellow">NUMPY</span></div>
                            <p class="l-questions__item-title">Javascript Error: IPython is not defined in JupyterLab</p>
                            <p class="l-questions__item-answers"><span>12</span> answers</p>
                        </div>
                        
                        </div>
                        <div class="l-questions__more-link"><a href="/cat/wiki/so/">All questions</a></div>
                    </div>
                    <div class="hub_ad">
                        <div id="ezoic-pub-ad-placeholder-106" style="position:sticky; position:-webkit-sticky; top:0; margin-top:10px; z-index: 1000">
                          <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9381065361874746"
                               crossorigin="anonymous"></script>
                          <!-- PYE aside NEW -->
                          <ins class="adsbygoogle"
                               style="display:block"
                               data-ad-client="ca-pub-9381065361874746"
                               data-ad-slot="8755532771"
                               data-ad-format="auto"
                               data-full-width-responsive="true"></ins>
                          <script>
                               (adsbygoogle = window.adsbygoogle || []).push({});
                          </script>  
                        </div>                   
                    </div>                    
                </div>
            </div>
        </div>
    </div>



<!-- news -->
    <div class="news">
        <div class="container">
            <h2 class="news__title h2">News</h2>
            <div class="news__items">

   
            <!--
            <a class="news__item" href="https://python.engineering/learn-programming-in-r-courses/" style="background-image: url('https://python.engineering/wp-content/uploads/2022/08/r-programming.jpeg')">
            -->
            <a class="news__item" href="https://python.engineering/learn-programming-in-r-courses/" style="background-color: #243978;">
                <span class="news__item-overlay">
                  <span class="news__item-cat">11/08/2022</span>
                  <span class="news__item-title">Learn programming in R: courses</span>
                </span>
            </a>
   
            <!--
            <a class="news__item" href="https://python.engineering/cisco-confirmed-hacking-of-its-corporate-systems/" style="background-image: url('https://python.engineering/wp-content/uploads/2022/08/pye-cisco-11-08-2022.jpeg')">
            -->
            <a class="news__item" href="https://python.engineering/cisco-confirmed-hacking-of-its-corporate-systems/" style="background-color: #243978;">
                <span class="news__item-overlay">
                  <span class="news__item-cat">11/08/2022</span>
                  <span class="news__item-title">Cisco confirmed hacking of its corporate systems, hackers stole 2.75 GB of data from the company's network</span>
                </span>
            </a>
   
            <!--
            <a class="news__item" href="https://python.engineering/researchers-talk-about-aepic-leak-attack/" style="background-image: url('https://python.engineering/wp-content/uploads/2022/08/pye-aepic-11-08-2022.jpeg')">
            -->
            <a class="news__item" href="https://python.engineering/researchers-talk-about-aepic-leak-attack/" style="background-color: #243978;">
                <span class="news__item-overlay">
                  <span class="news__item-cat">11/08/2022</span>
                  <span class="news__item-title">Researchers talk about AEPIC Leak attack that leaks keys from Intel SGX enclaves and show exploit code</span>
                </span>
            </a>
              
            </div>
        </div>
    </div>
<!-- /new -->

<br>

<!-- wiki -->
    <div class="wiki">
        <div class="container">
            <h2 class="wiki__title h2">Wiki</h2>
            <div class="wiki-grid">
               
                <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/python-opencv-cv2-puttext-method/"></a>
                    <div class="l-questions__item-tags">
                      <a href=""><span class="l-questions__item-tag violet">__del__</span></a>
                    </div>
                    <p class="l-questions__item-title">Python OpenCV | cv2.putText () method</p>
                </div>
               
                <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/numpy-arctan2-python/"></a>
                    <div class="l-questions__item-tags">
                      <a href=""><span class="l-questions__item-tag violet">__del__</span></a>
                    </div>
                    <p class="l-questions__item-title">numpy.arctan2 () in Python</p>
                </div>
               
                <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/python-os-path-realpath-method/"></a>
                    <div class="l-questions__item-tags">
                      <a href=""><span class="l-questions__item-tag violet">__del__</span></a>
                    </div>
                    <p class="l-questions__item-title">Python | os.path.realpath () method</p>
                </div>
               
                <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/python-opencv-cv2-circle-method/"></a>
                    <div class="l-questions__item-tags">
                      <a href=""><span class="l-questions__item-tag violet">around</span></a>
                    </div>
                    <p class="l-questions__item-title">Python OpenCV | cv2.circle () method</p>
                </div>
               
                <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/python-opencv-cv2-cvtcolor-method/"></a>
                    <div class="l-questions__item-tags">
                      <a href=""><span class="l-questions__item-tag violet">cvtcolor</span></a>
                    </div>
                    <p class="l-questions__item-title">Python OpenCV cv2.cvtColor () method</p>
                </div>
               
                <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/python-move-element-to-end-of-the-list/"></a>
                    <div class="l-questions__item-tags">
                      <a href=""><span class="l-questions__item-tag violet">Python functions</span></a>
                    </div>
                    <p class="l-questions__item-title">Python - Move item to the end of the list</p>
                </div>
               
                <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/time-perf_counter-function-in-python/"></a>
                    <div class="l-questions__item-tags">
                      <a href=""><span class="l-questions__item-tag violet">Counters</span></a>
                    </div>
                    <p class="l-questions__item-title">time.perf_counter () function in Python</p>
                </div>
               
                <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/python-check-if-one-list-is-subset-of-other/"></a>
                    <div class="l-questions__item-tags">
                      <a href=""><span class="l-questions__item-tag violet">__dict__</span></a>
                    </div>
                    <p class="l-questions__item-title">Check if one list is a subset of another in Python</p>
                </div>
               
                <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/python-os-path-join-method/"></a>
                    <div class="l-questions__item-tags">
                      <a href=""><span class="l-questions__item-tag violet">__del__</span></a>
                    </div>
                    <p class="l-questions__item-title">Python os.path.join () method</p>
                </div>
                
            </div>
        </div>
    </div>     
<!-- /wiki -->   






<!-- new footer -->
    <footer class="footer">
        <div class="container">
            <div class="footer__row">
                <div class="footer__left"><img class="footer__logo" src="/wp-content/themes/nimani/img/footer-logo.svg" alt="Python Engineering">
                    <p class="footer__copyright">© 2017—2022 <br> Python Engineering Hub</p>

                    <p class="footer__desc">
<a href="/cat/wiki/" class="footer__nav-link">EN</a> | <a href="/cat/es_sp/" class="footer__nav-link">ES</a> | <a href="/cat/de_de/" class="footer__nav-link">DE</a> | <a href="/cat/fr_fr/" class="footer__nav-link">FR</a> | <a href="/cat/it_it/" class="footer__nav-link">IT</a> | <a href="/cat/ru_ru/" class="footer__nav-link">RU</a> | <a href="/cat/tr_tr/" class="footer__nav-link">TR</a> | <a href="/cat/pl_pl/" class="footer__nav-link">PL</a> | <a href="/cat/pt_pt/" class="footer__nav-link">PT</a> | <a href="/cat/ja_jp/" class="footer__nav-link">JP</a> | <a href="/cat/ko_kr/" class="footer__nav-link">KR</a> | <a href="/cat/zh_cn/" class="footer__nav-link">CN</a> | <a href="/cat/hi_in/" class="footer__nav-link">HI</a> | <a href="/cat/nl_nl/" class="footer__nav-link">NL</a>
                    </p>   
                    <br>                    
                    <p class="footer__desc">
                    Python.Engineering is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com
                    </p>

                </div>
                <div class="footer__nav-col">
                    <p class="footer__nav-title">Python</p>
                    <ul class="footer__nav-list">
                        <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/loops/">Loops</a></li>
                        <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/counters/">Counters</a></li>
                        <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/numpy/">NumPy</a></li>
                        <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/nlp/">NLP</a></li>
                        <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/regex/">Regular Expressions</a></li>
                    </ul>
                </div>
                <div class="footer__nav-col">
                    <p class="footer__nav-title">Wiki</p>
                    <ul class="footer__nav-list">
                        <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/news/">Tech news</a></li>                        
                        <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/wiki/">Python Wiki</a></li>
                        <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/wiki/so/">StackOverflow</a></li>
                        <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/php/">PHP</a></li>
                        <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/javascript/">JavaScript</a></li>
                    </ul>
                </div>
                <div class="footer__nav-col">
                    <p class="footer__nav-title">Books</p>
                    <ul class="footer__nav-list">
                        <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/books/">All books</a></li>
                        <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/computations/">Computations</a></li>
                        <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/development/">Development</a></li>
                        <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/cryptography/">Cryptography</a></li>
                        <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/beginners/">For dummies</a></li>
                        <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/bigdata/">Big Data</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </footer>
    <script src="https://code.jquery.com/jquery-3.5.0.min.js"></script>
    <script src="/wp-content/themes/nimani/js/libs.js"></script>
    <script src="/wp-content/themes/nimani/js/index.js"></script>
    <script src="/wp-content/themes/nimani/js/vendor/lazysizes.min.js" async></script>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-Q022WLXW4X" async></script>
    <script async src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js?autoload=true&skin=desert&lang=python"></script>
    <script type="text/javascript">
        document.addEventListener("DOMContentLoaded", () => {
            let arrayCode = document.querySelectorAll('pre');
            arrayCode.forEach(element => {
                element.classList.add("prettyprint");
            });
        });        
    </script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-Q022WLXW4X');
    </script>


<!-- ===================== LEAVE POPUP ===================== -->

<!--     <script src="/wp-content/themes/nimani/js/ouibounce.js"></script>
    <script>
      // if you want to use the 'fire' or 'disable' fn,
      // you need to save OuiBounce to an object
      var _ouibounce = ouibounce(document.getElementById('ouibounce-modal'), {
        aggressive: true,
        timer: 0,
        delay: 1000,
        callback: function() { console.log('ouibounce fired!'); }
      });

      $('body').on('click', function() {
        $('#ouibounce-modal').hide();
      });

      $('#ouibounce-modal .modal-footer').on('click', function() {
        $('#ouibounce-modal').hide();
      });

      $('#ouibounce-modal .modal').on('click', function(e) {  e.stopPropagation();});
    </script>

    <script>
    $("#reload_form_button" ).click(function() {
        console.log("hui");
    $('#reload_form').load('/wp-content/themes/nimani/af.html');
    });
    </script> -->
<!-- ===================== /LEAVE POPUP ===================== -->


</body>

</html>
<!-- /new footer -->