搜尋

HTML入門教學

Jun 26, 2017 pm 03:17 PM
html入門

1、HTML簡介

HTML(Hypertext Markup Language)即超文本標記語言,是用來描述網頁文件的一種標記語言。

HTML 標記標籤通常被稱為 HTML 標籤 (HTML tag)。 HTML提供了許多標記,如段落標記、標題標記、超連結標記、圖片標記等,網頁中需要定義什麼內容,就用對應的HTML標記來描述即可。

 

2、HTML結構

 1 nbsp;html><!-- 表示HTML5文档协议声明标签,协议的不同会影响整个页面的显示效果 --> 2 <!-- <html>表示文档标签 --> 3 <!-- <head>标签表示文档的头部标签,在<head>标签中的信息是用于给浏览器识别的内容,如这里的<meta charset="UTF-8">用于告知浏览器该文档的编码为UTF-8 --> 4     <meta> 5     <!-- 这是注释,不会显示在网页上,注释的内容写在符号之间 --> 6     <title>第一个HTML文件</title><!-- <title>表示该文档的标题 --> 7  8  9 <!-- <body>标签为我们在浏览器中看到的内容 -->10     第一个HTML文件11  12 

#註解的內容寫在符號之間,在瀏覽器中的運作效果如下

 

3、HTML頭部標籤

3.1、標記

標記位於文件的最前面,用於向瀏覽器說明目前文件使用哪種HTML 或XHTML 標準規範。主要用於瀏覽器解析文件標籤的依據。

標記和瀏覽器的兼容性相關,如果刪除,就意味著讓瀏覽器來顯示HTML頁面的內容。這時,IE6,IE7,IE8,Firefox2,Firefox3,Chrome,有多少瀏覽器,頁面就有可能有多少種顯示效果,這是不被允許的。

 

3.2、標記

#標記位於 標記之後,也稱為根標記,用於告知瀏覽器其本身是一個HTML 文檔, 標記標誌著HTML文檔的開始,標記標誌著HTML文檔的結束,在他們之間的是文檔的頭部和主體內容。所有的標籤必須寫在與這兩個閉合標籤之間。可以透過lang屬性設定目前文檔的主要語言是什麼,幫助搜尋引擎解析文檔,如:表示目前文檔語言為中文。

3.3、標記

標記用於定義HTML文件的頭部訊息,也稱為頭部標記,緊接在標記之後。 head標籤定義的內容只是提供給瀏覽器使用,不用於使用者的呈現。 主要用來封裝其他位於文件頭部的標記,例如、<meta>、<link>及<style>等,用來描述文件的標題、作者以及和其他文件的關係等。 <span style="color: #ff00ff; font-size: 16px;">一個HTML文件只能含有一對<head>標記,絕大多數文件頭部包含的資料都不會真正顯示在頁面中作為內容。 <br/><br/><h4>3.4、<meta>標記<p>#<meta>標記可提供有關頁面的元資訊(meta-information),例如針對搜尋引擎和更新頻度的描述和關鍵字。 <p><meta> 標籤位於文件的頭部,不包含任何內容。 <meta> 標籤的屬性定義了與文件相關聯的名稱/值對。如:<div class="cnblogs_code"><pre class="brush:php;toolbar:false"><meta name="keywords" content="HTML,ASP,PHP,SQL"><p>"keywords" 是一個常用到的名稱。它為文檔定義了一組關鍵字。某些搜尋引擎在遇到這些關鍵字時,會用這些關鍵字來分類文件。 <br/><br/><h4>3.5、<title>標記<p>#<title>標記用來定義HTML頁面的標題,即為網頁取一個名字,必須位於<head&gt ;標記之內。一個HTML文件只能含有一對<title></style> </title>標記,<title></title>之間的內容將顯示在瀏覽器視窗的標題列中。其基本語法格式如下:<div class="cnblogs_code"><pre class="brush:php;toolbar:false"><title>网页标题名称</title></pre></div> <p><span style="font-size: 16px; color: #ff00ff;">title標籤對於網站SEO至關重要,標題的好壞直接影響網站的SEO。 </span><br><br></p> <h4 id="link-標記">3.6、<link>標記</h4> <p>#<link>標記最常用的用法是用來連結外部的CSS文件,</p> <div class="cnblogs_code"><pre class="brush:php;toolbar:false"><link></pre></div> <p>此外還可以用來介紹網站的icon圖示</p> <div class="cnblogs_code"><pre class="brush:php;toolbar:false"><link></pre></div> <p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/7521b8227cc686766ee6725e3c937478-1.png?x-oss-process=image/resize,p_40" class="lazy" alt=""></p> <p> </p> <h3 id="HTML內容標籤">4、HTML內容標籤</h3> <h4 id="標題標籤">#4.1、標題標籤</h4> <p>標題標籤用</p> <h1> - <h6 id="定義最大的標題-h-定義最小的標題-從-h-h-相對於目前文件的重要性依序降低-建議h-標籤在整個頁面中最多出現一次-當然可以超過-但不利於搜尋SEO-span-style-font-size-px-color-ff-ff-標題標籤是用來體現文件內容的重要性-span-不要只是為了產生粗體或大號的文字而使用標題"> 定義最大的標題。 <h6> 定義最小的標題,從<h1> - <h6>,相對於目前文件的重要性依序降低。建議h1標籤在整個頁面中最多出現一次(當然可以超過,但不利於搜尋SEO)。 <span style="font-size: 16px; color: #ff00ff;">標題標籤是用來體現文件內容的重要性</span>,不要只是為了產生粗體或大號的文字而使用標題。 </h6> </h1> </h6> </h6> </h1> <p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/b2d0086c776e4dd4c081b8c3c9c17772-2.png?x-oss-process=image/resize,p_40" class="lazy" alt="">  <img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/b2d0086c776e4dd4c081b8c3c9c17772-3.png?x-oss-process=image/resize,p_40" class="lazy" alt=""></p> <p><span style="color: #ff00ff; font-size: 16px;">注意:瀏覽器會自動地在標題的前後新增空白行。 </span></p> <h4 id="段落標籤">4.2、段落標籤</h4> <p>段落是透過 </p> <p> 標籤定義的,p標籤之間不會互相共用一行,會獨佔一行或多行的空間。 </p> <p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/b2d0086c776e4dd4c081b8c3c9c17772-4.png?x-oss-process=image/resize,p_40" class="lazy" alt="">  <img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/93b5d2ff7156018c4882a3ecff1ab0b2-5.png?x-oss-process=image/resize,p_40" class="lazy" alt="">    </p> <h4 id="水平線標記">4.3、水平線標記</h4> <p>hr標籤表示在頁面中插入一條水平線,<span style="color: #ff00ff; font-size: 16px;">hr標籤是單一標籤</span>,不需要閉合標籤。 </p> <p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/93b5d2ff7156018c4882a3ecff1ab0b2-6.png?x-oss-process=image/resize,p_40" class="lazy" alt="">  <img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/93b5d2ff7156018c4882a3ecff1ab0b2-7.png?x-oss-process=image/resize,p_40" class="lazy" alt="">  </p> <h4 id="換行標籤">4.4、換行標籤</h4> <p><br> 可插入一個簡單的換行符,也是一個<span style="font-size: 16px; color: #ff00ff;">單一標籤</span> ,不需要閉合標籤。 </p> <p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/93b5d2ff7156018c4882a3ecff1ab0b2-8.png?x-oss-process=image/resize,p_40" class="lazy" alt="">  <img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/1051e1f8cf622765bc11a607dd5e2551-9.png?x-oss-process=image/resize,p_40" class="lazy" alt=""></p> <h4 id="span標籤">4.5、span標籤</h4> <p><span> 標籤被用來組合文件中的行內元素,span標籤可以跟其他的span標籤共用一行。通常情況下,需要為span標籤套用樣式,否則與頁面上的其他文字沒有什麼任何區別。 </span></p> <p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/1051e1f8cf622765bc11a607dd5e2551-10.png?x-oss-process=image/resize,p_40" class="lazy" alt="">  <img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/1051e1f8cf622765bc11a607dd5e2551-11.png?x-oss-process=image/resize,p_40" class="lazy" alt=""></p> <h4 id="div標籤">4.6、div標籤</h4> <p></p> <div> 元素來組合區塊級元素,這樣就可以使用樣式來格式化它們。 <p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/e57ab189241f6c0bed74aca321e3aca3-12.png?x-oss-process=image/resize,p_40" class="lazy" alt="">  <img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/e57ab189241f6c0bed74aca321e3aca3-13.png?x-oss-process=image/resize,p_40" class="lazy" alt=""></p> <h4 id="img標籤">4.7、 img標籤</h4> <p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/e57ab189241f6c0bed74aca321e3aca3-14.png?x-oss-process=image/resize,p_40" class="lazy" alt="HTML入門教學" > 標籤向網頁中嵌入一幅圖像,從技術上講,<span style="max-width:90%">< ;img> 標籤並不會在網頁中插入圖像,而是從網頁上連結圖像。 </span><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/e57ab189241f6c0bed74aca321e3aca3-14.png?x-oss-process=image/resize,p_40" class="lazy" alt="HTML入門教學" > 標籤創建的是被引用圖像的佔位空間。 </p> <p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/e57ab189241f6c0bed74aca321e3aca3-14.png?x-oss-process=image/resize,p_40" class="lazy" alt="HTML入門教學" > 標籤有兩個必要的屬性:src 屬性 和 alt 屬性。 </p> <p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/e57ab189241f6c0bed74aca321e3aca3-14.png?x-oss-process=image/resize,p_40" class="lazy" alt="">  <img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/8c3ae83c5f1506f33dad53805cf414a0-15.gif?x-oss-process=image/resize,p_40" class="lazy" alt=""></p> <h3 id="HTML進階標籤">5、HTML進階標籤</h3> <h4 id="清單標籤">5.1、清單標籤</h4> <h5 id="無序列表">5.1.1、無序列表</h5> <p>無序列表用ul標籤來表示,其中的列表項目以li標籤表示,<span style="font-size: 16px; color: #ff00ff;">無序列表的各個列表項之間<span style="color: #ff00ff; font-size: 16px;">沒有順序級別之分,是並列的</span></span></p> <p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/8c3ae83c5f1506f33dad53805cf414a0-16.png?x-oss-process=image/resize,p_40" class="lazy" alt="">#  <img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/7f6e465cd7303cd559a16db04ea3d3e0-17.png?x-oss-process=image/resize,p_40" class="lazy" alt=""></p> <h5 id="有序列表">5.1.2、有序列表</h5> <p>有序列表用ol標籤來表示,其中的列表項也用li標籤表示,其各個列表項<span style="font-size: 16px; color: #ff00ff;">依照一定的順序排列定義</span></p> <p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/7f6e465cd7303cd559a16db04ea3d3e0-18.png?x-oss-process=image/resize,p_40" class="lazy" alt="">  <img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/7f6e465cd7303cd559a16db04ea3d3e0-19.png?x-oss-process=image/resize,p_40" class="lazy" alt=""></p> <h5 id="自訂清單">5.1.3、自訂清單</h5> <p>自訂列表常用於對術語或名詞進行解釋和描述,定義列表的列表項目前沒有任何項目符號</p> <p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/8d4bb3e16f60a4bd67fb17c618e5bf5f-20.png?x-oss-process=image/resize,p_40" class="lazy" alt="">  <img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/8d4bb3e16f60a4bd67fb17c618e5bf5f-21.png?x-oss-process=image/resize,p_40" class="lazy" alt=""></p> <h4 id="表格標籤">5.2、表格標籤</h4> <p>#簡單的HTML 表格由table 元素以及一個或多個tr、th 或td 元素組成,tr 元素定義表格行,th 元素定義表頭,td 元素定義表格單元,一個簡單的範例如下:</p> <p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/8d4bb3e16f60a4bd67fb17c618e5bf5f-22.png?x-oss-process=image/resize,p_40" class="lazy" alt="">  <img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/103ea6f3942105647a54088462301bc1-23.png?x-oss-process=image/resize,p_40" class="lazy" alt=""></p> <h4 id="表單標籤">5.3、表單標籤</h4> <h5 id="Form標籤">#5.3.1 、Form標籤</h5> <p>表單的網域標籤,用於包裹整個表單的內容。表單就是使用者提交資料到後台的一個虛擬單子,表單一般由文字方塊、下拉清單、單選、多選、文字網域等組成,Action屬性,用來指定目前表單提交的時候指向後台的位址。 <br><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/103ea6f3942105647a54088462301bc1-24.png?x-oss-process=image/resize,p_40" class="lazy" alt="">  <img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/103ea6f3942105647a54088462301bc1-25.gif?x-oss-process=image/resize,p_40" class="lazy" alt="">   </p> <h5 id="Input標籤">5.3.2、Input標籤</h5> <p>Input標籤是文字方塊、單選、多選、按鈕等。 <span style="font-size: 16px; color: #ff00ff;">Type屬性不同的值決定了input標籤的作用。 </span></p> <p>文字方塊:text<br>密碼方塊:password<br>單選:radio<br>多選:checkbox<br>按鈕:button<br>提交按鈕:submit<br>重置按鈕: reset<br><br></p> <p>Input標籤的checked屬性,屬性值只有一個checked,可以省略屬性值,在單選按鈕和多選按鈕中表示此按鈕被選取。 </p> <p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/556c2f5f17f10703365154b3eba3b38d-26.png?x-oss-process=image/resize,p_40" class="lazy" alt="">  <img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/556c2f5f17f10703365154b3eba3b38d-27.png?x-oss-process=image/resize,p_40" class="lazy" alt=""></p> <p> </p> <h5 id="Select標籤">#5.3.3、Select標籤</h5> <p>select 元素可建立單選或多選選單,<select> 標籤用於定義清單中的可用選項。 </select></p> <p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/b87b341e55fcc435a4a6aa7390b38c21-28.png?x-oss-process=image/resize,p_40" class="lazy" alt="">  <img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/b87b341e55fcc435a4a6aa7390b38c21-29.gif?x-oss-process=image/resize,p_40" class="lazy" alt=""></p> <p>Multipe:也是一個單一屬性。值只有一個multiple。設定了此屬性表示select標籤表現為 清單標籤。否則表示下拉清單標籤。 </p> <p> </p> <h5 id="文字網域標籤">5.3.4、文字網域標籤</h5> <p>Textarea文字網域標籤,用來輸入大量文字的的標籤。文字域標籤的cols表示可以容納多少列字元。 Rows容納多少行資料。 </p> <p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/b87b341e55fcc435a4a6aa7390b38c21-30.png?x-oss-process=image/resize,p_40" class="lazy" alt="">  <img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/80ea271348d878577289dc6c3deec3a3-31.png?x-oss-process=image/resize,p_40" class="lazy" alt=""></p> <p> </p> <h5 id="Lable標籤">#5.3.5、Lable標籤</h5> <p>Lable標籤可以讓標籤文字點選的時候讓label指向的標籤表單標籤獲得焦點。 </p> <p>兩種方式:1、使用for屬性指向 表單標籤  2、用lable標籤包裹表單標籤。 </p> <p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/80ea271348d878577289dc6c3deec3a3-32.png?x-oss-process=image/resize,p_40" class="lazy" alt="">  <img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/001/80ea271348d878577289dc6c3deec3a3-33.gif?x-oss-process=image/resize,p_40" class="lazy" alt=""></p> <p># </p> </div><p>以上是HTML入門教學的詳細內容。更多資訊請關注PHP中文網其他相關文章!</p></div><div class="wzconShengming_sp"><div class="bzsmdiv_sp">陳述</div><div>本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn</div></div></div><div class="phpgenera_Details_mainL4"><div class="phpmain1_2_top"><a href="javascript:void(0);" class="phpmain1_2_top_title">相關文章<img class="lazy" data-src="/static/imghwm/index2_title2.png" src="/static/imghw/default1.png" alt="" /></a></div><div class="phpgenera_Details_mainL4_info"><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh-tw/faq/1796794693.html" title="了解HTML,CSS和JavaScript:初學者指南" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/article/001/253/068/174438733162787.jpg?x-oss-process=image/resize,p_40" alt="了解HTML,CSS和JavaScript:初學者指南" src="/static/imghw/default1.png" /></a><a href="https://m.php.cn/zh-tw/faq/1796794693.html" title="了解HTML,CSS和JavaScript:初學者指南" class="phphistorical_Version2_mids_title">了解HTML,CSS和JavaScript:初學者指南</a><span class="Articlelist_txts_time">Apr 12, 2025 am 12:02 AM</span><p class="Articlelist_txts_p">WebDevelovermentReliesonHtml,CSS和JavaScript:1)HTMLStructuresContent,2)CSSStyleSIT和3)JavaScriptAddSstractivity,形成thebasisofmodernWebemodernWebExexperiences。</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh-tw/faq/1796794180.html" title="HTML的角色:構建Web內容" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/article/001/253/068/174430155217186.jpg?x-oss-process=image/resize,p_40" alt="HTML的角色:構建Web內容" src="/static/imghw/default1.png" /></a><a href="https://m.php.cn/zh-tw/faq/1796794180.html" title="HTML的角色:構建Web內容" class="phphistorical_Version2_mids_title">HTML的角色:構建Web內容</a><span class="Articlelist_txts_time">Apr 11, 2025 am 12:12 AM</span><p class="Articlelist_txts_p">HTML的作用是通過標籤和屬性定義網頁的結構和內容。 1.HTML通過到、等標籤組織內容,使其易於閱讀和理解。 2.使用語義化標籤如、等增強可訪問性和SEO。 3.優化HTML代碼可以提高網頁加載速度和用戶體驗。</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh-tw/faq/1796793634.html" title="HTML和代碼:仔細觀察術語" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/article/001/253/068/174424853215422.jpg?x-oss-process=image/resize,p_40" alt="HTML和代碼:仔細觀察術語" src="/static/imghw/default1.png" /></a><a href="https://m.php.cn/zh-tw/faq/1796793634.html" title="HTML和代碼:仔細觀察術語" class="phphistorical_Version2_mids_title">HTML和代碼:仔細觀察術語</a><span class="Articlelist_txts_time">Apr 10, 2025 am 09:28 AM</span><p class="Articlelist_txts_p">htmlisaspecifictypefodyfocusedonstructuringwebcontent,而“代碼” badlyLyCludEslanguagesLikeLikejavascriptandPytyPythonForFunctionality.1)htmldefineswebpagertuctureduseTags.2)“代碼”代碼“ code” code code code codeSpassSesseseseseseseseAwiderRangeLangeLangeforLageforLogageforLogicIctInterract</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh-tw/faq/1796793129.html" title="HTML,CSS和JavaScript:Web開發人員的基本工具" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/article/001/253/068/174412873346901.jpg?x-oss-process=image/resize,p_40" alt="HTML,CSS和JavaScript:Web開發人員的基本工具" src="/static/imghw/default1.png" /></a><a href="https://m.php.cn/zh-tw/faq/1796793129.html" title="HTML,CSS和JavaScript:Web開發人員的基本工具" class="phphistorical_Version2_mids_title">HTML,CSS和JavaScript:Web開發人員的基本工具</a><span class="Articlelist_txts_time">Apr 09, 2025 am 12:12 AM</span><p class="Articlelist_txts_p">HTML、CSS和JavaScript是Web開發的三大支柱。 1.HTML定義網頁結構,使用標籤如、等。 2.CSS控製網頁樣式,使用選擇器和屬性如color、font-size等。 3.JavaScript實現動態效果和交互,通過事件監聽和DOM操作。</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh-tw/faq/1796792987.html" title="HTML,CSS和JavaScript的角色:核心職責" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/article/001/253/068/174411031220217.jpg?x-oss-process=image/resize,p_40" alt="HTML,CSS和JavaScript的角色:核心職責" src="/static/imghw/default1.png" /></a><a href="https://m.php.cn/zh-tw/faq/1796792987.html" title="HTML,CSS和JavaScript的角色:核心職責" class="phphistorical_Version2_mids_title">HTML,CSS和JavaScript的角色:核心職責</a><span class="Articlelist_txts_time">Apr 08, 2025 pm 07:05 PM</span><p class="Articlelist_txts_p">HTML定義網頁結構,CSS負責樣式和佈局,JavaScript賦予動態交互。三者在網頁開發中各司其職,共同構建豐富多彩的網站。</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh-tw/faq/1796791823.html" title="HTML容易為初學者學習嗎?" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/article/001/253/068/174395586298618.jpg?x-oss-process=image/resize,p_40" alt="HTML容易為初學者學習嗎?" src="/static/imghw/default1.png" /></a><a href="https://m.php.cn/zh-tw/faq/1796791823.html" title="HTML容易為初學者學習嗎?" class="phphistorical_Version2_mids_title">HTML容易為初學者學習嗎?</a><span class="Articlelist_txts_time">Apr 07, 2025 am 12:11 AM</span><p class="Articlelist_txts_p">HTML適合初學者學習,因為它簡單易學且能快速看到成果。 1)HTML的學習曲線平緩,易於上手。 2)只需掌握基本標籤即可開始創建網頁。 3)靈活性高,可與CSS和JavaScript結合使用。 4)豐富的學習資源和現代工具支持學習過程。</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh-tw/faq/1796791144.html" title="HTML中起始標籤的示例是什麼?" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/article/001/253/068/174386905283883.jpg?x-oss-process=image/resize,p_40" alt="HTML中起始標籤的示例是什麼?" src="/static/imghw/default1.png" /></a><a href="https://m.php.cn/zh-tw/faq/1796791144.html" title="HTML中起始標籤的示例是什麼?" class="phphistorical_Version2_mids_title">HTML中起始標籤的示例是什麼?</a><span class="Articlelist_txts_time">Apr 06, 2025 am 12:04 AM</span><p class="Articlelist_txts_p">AnexampleOfAstartingTaginHtmlis,beginSaparagraph.startingTagSareEssentialInhtmlastheyInitiateEllements,defiteTheeTheErtypes,andarecrucialforsstructuringwebpages wepages webpages andConstructingthedom。</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh-tw/faq/1796790923.html" title="如何利用CSS的Flexbox佈局實現菜單中虛線分割效果的居中對齊?" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/article/001/246/273/174286321766559.jpg?x-oss-process=image/resize,p_40" alt="如何利用CSS的Flexbox佈局實現菜單中虛線分割效果的居中對齊?" src="/static/imghw/default1.png" /></a><a href="https://m.php.cn/zh-tw/faq/1796790923.html" title="如何利用CSS的Flexbox佈局實現菜單中虛線分割效果的居中對齊?" class="phphistorical_Version2_mids_title">如何利用CSS的Flexbox佈局實現菜單中虛線分割效果的居中對齊?</a><span class="Articlelist_txts_time">Apr 05, 2025 pm 01:24 PM</span><p class="Articlelist_txts_p">如何設計菜單中的虛線分割效果?在設計菜單時,菜名和價格的左右對齊通常不難實現,但中間的虛線或點如何...</p></div></div><a href="https://m.php.cn/zh-tw/web-designer.html" class="phpgenera_Details_mainL4_botton"><span>See all articles</span><img class="lazy" data-src="/static/imghwm/down_right.png" src="/static/imghw/default1.png" alt="" /></a></div><ins class="adsbygoogle" style="display:block" data-ad-format="fluid" data-ad-layout-key="-6t+ed+2i-1n-4w" data-ad-client="ca-pub-5902227090019525" data-ad-slot="8966999616"></ins><script> (adsbygoogle = window.adsbygoogle || []).push({}); </script><div class="AI_ToolDetails_main4sR"><div class="phpgenera_Details_mainR3"><div class="phpmain1_4R_readrank"><div class="phpmain1_4R_readrank_top"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="/static/imghwm/hottools2.png" src="/static/imghw/default1.png" alt="" /><h2>熱AI工具</h2></div><div class="phpgenera_Details_mainR3_bottom"><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh-tw/ai/undresserai-undress" title="Undresser.AI Undress" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/ai_manual/001/246/273/173411540686492.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Undresser.AI Undress" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh-tw/ai/undresserai-undress" title="Undresser.AI Undress"class="phpmain_tab2_mids_title"><h3>Undresser.AI Undress</h3></a><p>人工智慧驅動的應用程序,用於創建逼真的裸體照片</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh-tw/ai/ai-clothes-remover" title="AI Clothes Remover" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/ai_manual/001/246/273/173411552797167.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="AI Clothes Remover" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh-tw/ai/ai-clothes-remover" title="AI Clothes Remover"class="phpmain_tab2_mids_title"><h3>AI Clothes Remover</h3></a><p>用於從照片中去除衣服的線上人工智慧工具。</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh-tw/ai/undress-ai-tool" title="Undress AI Tool" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/ai_manual/001/246/273/173410641626608.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Undress AI Tool" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh-tw/ai/undress-ai-tool" title="Undress AI Tool"class="phpmain_tab2_mids_title"><h3>Undress AI Tool</h3></a><p>免費脫衣圖片</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh-tw/ai/clothoffio" title="Clothoff.io" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/ai_manual/001/246/273/173411529149311.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Clothoff.io" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh-tw/ai/clothoffio" title="Clothoff.io"class="phpmain_tab2_mids_title"><h3>Clothoff.io</h3></a><p>AI脫衣器</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh-tw/ai/ai-hentai-generator" title="AI Hentai Generator" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/ai_manual/001/246/273/173405034393877.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="AI Hentai Generator" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh-tw/ai/ai-hentai-generator" title="AI Hentai Generator"class="phpmain_tab2_mids_title"><h3>AI Hentai Generator</h3></a><p>免費產生 AI 無盡。</p></div></div></div><div class="phpgenera_Details_mainR3_more"><a href="https://m.php.cn/zh-tw/ai">顯示更多</a></div></div></div><div class="phpgenera_Details_mainR4"><div class="phpmain1_4R_readrank"><div class="phpmain1_4R_readrank_top"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="/static/imghwm/hotarticle2.png" src="/static/imghw/default1.png" alt="" /><h2>熱門文章</h2></div><div class="phpgenera_Details_mainR4_bottom"><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh-tw/faq/1796780570.html" title="R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)" class="phpgenera_Details_mainR4_bottom_title">R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)</a><div class="phpgenera_Details_mainR4_bottoms_info"><span>3 週前</span><span>By尊渡假赌尊渡假赌尊渡假赌</span></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh-tw/faq/1796780641.html" title="R.E.P.O.最佳圖形設置" class="phpgenera_Details_mainR4_bottom_title">R.E.P.O.最佳圖形設置</a><div class="phpgenera_Details_mainR4_bottoms_info"><span>3 週前</span><span>By尊渡假赌尊渡假赌尊渡假赌</span></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh-tw/faq/1796785841.html" title="刺客信條陰影:貝殼謎語解決方案" class="phpgenera_Details_mainR4_bottom_title">刺客信條陰影:貝殼謎語解決方案</a><div class="phpgenera_Details_mainR4_bottoms_info"><span>2 週前</span><span>ByDDD</span></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh-tw/faq/1796780520.html" title="R.E.P.O.如果您聽不到任何人,如何修復音頻" class="phpgenera_Details_mainR4_bottom_title">R.E.P.O.如果您聽不到任何人,如何修復音頻</a><div class="phpgenera_Details_mainR4_bottoms_info"><span>3 週前</span><span>By尊渡假赌尊渡假赌尊渡假赌</span></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh-tw/faq/1796779766.html" title="WWE 2K25:如何解鎖Myrise中的所有內容" class="phpgenera_Details_mainR4_bottom_title">WWE 2K25:如何解鎖Myrise中的所有內容</a><div class="phpgenera_Details_mainR4_bottoms_info"><span>4 週前</span><span>By尊渡假赌尊渡假赌尊渡假赌</span></div></div></div><div class="phpgenera_Details_mainR3_more"><a href="https://m.php.cn/zh-tw/article.html">顯示更多</a></div></div></div><div class="phpgenera_Details_mainR3"><div class="phpmain1_4R_readrank"><div class="phpmain1_4R_readrank_top"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="/static/imghwm/hottools2.png" src="/static/imghw/default1.png" alt="" /><h2>熱工具</h2></div><div class="phpgenera_Details_mainR3_bottom"><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh-tw/toolset/development-tools/500" title="SublimeText3 Mac版" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/001/58d34035e2757995.png" src="/static/imghw/default1.png" alt="SublimeText3 Mac版" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh-tw/toolset/development-tools/500" title="SublimeText3 Mac版" class="phpmain_tab2_mids_title"><h3>SublimeText3 Mac版</h3></a><p>神級程式碼編輯軟體(SublimeText3)</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh-tw/toolset/development-tools/1575" title="DVWA" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/005/169233952150073.png" src="/static/imghw/default1.png" alt="DVWA" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh-tw/toolset/development-tools/1575" title="DVWA" class="phpmain_tab2_mids_title"><h3>DVWA</h3></a><p>Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh-tw/toolset/development-tools/93" title="SublimeText3漢化版" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/001/58ab97a3baad9677.jpg" src="/static/imghw/default1.png" alt="SublimeText3漢化版" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh-tw/toolset/development-tools/93" title="SublimeText3漢化版" class="phpmain_tab2_mids_title"><h3>SublimeText3漢化版</h3></a><p>中文版,非常好用</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh-tw/toolset/development-tools/1557" title="mPDF" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/003/169206948656118.png" src="/static/imghw/default1.png" alt="mPDF" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh-tw/toolset/development-tools/1557" title="mPDF" class="phpmain_tab2_mids_title"><h3>mPDF</h3></a><p>mPDF是一個PHP庫,可以從UTF-8編碼的HTML產生PDF檔案。原作者Ian Back編寫mPDF以從他的網站上「即時」輸出PDF文件,並處理不同的語言。與原始腳本如HTML2FPDF相比,它的速度較慢,並且在使用Unicode字體時產生的檔案較大,但支援CSS樣式等,並進行了大量增強。支援幾乎所有語言,包括RTL(阿拉伯語和希伯來語)和CJK(中日韓)。支援嵌套的區塊級元素(如P、DIV),</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh-tw/toolset/development-tools/1492" title="EditPlus 中文破解版" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/001/5e21527e79622256.png" src="/static/imghw/default1.png" alt="EditPlus 中文破解版" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh-tw/toolset/development-tools/1492" title="EditPlus 中文破解版" class="phpmain_tab2_mids_title"><h3>EditPlus 中文破解版</h3></a><p>體積小,語法高亮,不支援程式碼提示功能</p></div></div></div><div class="phpgenera_Details_mainR3_more"><a href="https://m.php.cn/zh-tw/ai">顯示更多</a></div></div></div><div class="phpgenera_Details_mainR4"><div class="phpmain1_4R_readrank"><div class="phpmain1_4R_readrank_top"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="/static/imghwm/hotarticle2.png" src="/static/imghw/default1.png" alt="" /><h2>熱門話題</h2></div><div class="phpgenera_Details_mainR4_bottom"><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh-tw/faq/gmailyxdlrkzn" title="gmail信箱登陸入口在哪裡" class="phpgenera_Details_mainR4_bottom_title">gmail信箱登陸入口在哪裡</a><div class="phpgenera_Details_mainR4_bottoms_info"><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/eyess.png" src="/static/imghw/default1.png" alt="" /><span>7469</span></div><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/tiezi.png" src="/static/imghw/default1.png" alt="" /><span>15</span></div></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh-tw/faq/cakephp-tutor" title="CakePHP 教程" class="phpgenera_Details_mainR4_bottom_title">CakePHP 教程</a><div class="phpgenera_Details_mainR4_bottoms_info"><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/eyess.png" src="/static/imghw/default1.png" alt="" /><span>1376</span></div><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/tiezi.png" src="/static/imghw/default1.png" alt="" /><span>52</span></div></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh-tw/faq/steamdzhmcssmgs" title="steam的賬戶名稱是什麼格式" class="phpgenera_Details_mainR4_bottom_title">steam的賬戶名稱是什麼格式</a><div class="phpgenera_Details_mainR4_bottoms_info"><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/eyess.png" src="/static/imghw/default1.png" alt="" /><span>77</span></div><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/tiezi.png" src="/static/imghw/default1.png" alt="" /><span>11</span></div></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh-tw/faq/winactivationkeyper" title="win11激活密鑰永久" class="phpgenera_Details_mainR4_bottom_title">win11激活密鑰永久</a><div class="phpgenera_Details_mainR4_bottoms_info"><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/eyess.png" src="/static/imghw/default1.png" alt="" /><span>48</span></div><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/tiezi.png" src="/static/imghw/default1.png" alt="" /><span>19</span></div></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh-tw/faq/newyorktimesdailybrief" title="NYT連接提示和答案" class="phpgenera_Details_mainR4_bottom_title">NYT連接提示和答案</a><div class="phpgenera_Details_mainR4_bottoms_info"><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/eyess.png" src="/static/imghw/default1.png" alt="" /><span>19</span></div><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/tiezi.png" src="/static/imghw/default1.png" alt="" /><span>29</span></div></div></div></div><div class="phpgenera_Details_mainR3_more"><a href="https://m.php.cn/zh-tw/faq/zt">顯示更多</a></div></div></div></div></main><ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5902227090019525" data-ad-slot="5027754603"></ins><script> (adsbygoogle = window.adsbygoogle || []).push({}); </script><footer><div class="footer"><div class="footertop"><img src="/static/imghwm/logo.png" alt=""><p>公益線上PHP培訓,幫助PHP學習者快速成長!</p></div><div class="footermid"><a href="https://m.php.cn/zh-tw/about/us.html">關於我們</a><a href="https://m.php.cn/zh-tw/about/disclaimer.html">免責聲明</a><a href="https://m.php.cn/zh-tw/update/article_0_1.html">Sitemap</a></div><div class="footerbottom"><p> © php.cn All rights reserved </p></div></div></footer><script>isLogin = 0;</script><script type="text/javascript" src="/static/layui/layui.js"></script><script type="text/javascript" src="/static/js/global.js?4.9.47"></script><script src="https://vdse.bdstatic.com//search-video.v1.min.js"></script><link rel='stylesheet' id='_main-css' href='/static/css/viewer.min.css' type='text/css' media='all'/><script type='text/javascript' src='/static/js/viewer.min.js?1'></script><script type='text/javascript' src='/static/js/jquery-viewer.min.js'></script><script> var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="https://tongji.php.cn/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '9']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script><script> jQuery.fn.wait = function (func, times, interval) { var _times = times || -1, //100次 _interval = interval || 20, //20毫秒每次 _self = this, _selector = this.selector, //选择器 _iIntervalID; //定时器id if( this.length ){ //如果已经获取到了,就直接执行函数 func && func.call(this); } else { _iIntervalID = setInterval(function() { if(!_times) { //是0就退出 clearInterval(_iIntervalID); } _times <= 0 || _times--; //如果是正数就 -- _self = $(_selector); //再次选择 if( _self.length ) { //判断是否取到 func && func.call(_self); clearInterval(_iIntervalID); } }, _interval); } return this; } $("table.syntaxhighlighter").wait(function() { $('table.syntaxhighlighter').append("<p class='cnblogs_code_footer'><span class='cnblogs_code_footer_icon'></span></p>"); }); $(document).on("click", ".cnblogs_code_footer",function(){ $(this).parents('table.syntaxhighlighter').css('display','inline-table');$(this).hide(); }); $('.nphpQianCont').viewer({navbar:true,title:false,toolbar:false,movable:false,viewed:function(){$('img').click(function(){$('.viewer-close').trigger('click');});}}); </script><script>// 通用函数,用于显示或隐藏元素 function toggleElementsDisplay(className, show) { const elements = document.getElementsByClassName(className); for (let i = 0; i < elements.length; i++) { elements[i].style.display = show ? "block" : "none"; } } // 页面加载完成后执行的主函数 document.addEventListener("DOMContentLoaded", () => { // 1. 绑定菜单按钮事件 const bindMenuEvents = () => { const toggleDisplay = (className, show, eventId) => { const element = document.getElementById(eventId); if (element) { element.addEventListener("click", (event) => { event.preventDefault(); toggleElementsDisplay(className, show); }); } }; toggleDisplay("m_editormain12main", true, "fixed_tab_img"); toggleDisplay("m_editormain12main", false, "fixed_tab_topi"); toggleDisplay("m_editormain12main", false, "fixed_tab_close"); toggleDisplay("m_menu", true, "lan1sp"); toggleDisplay("m_menu", false, "m_editormain12main_topi_sp"); toggleDisplay("m_menu_lang", true, "lan1"); toggleDisplay("m_menu_lang", false, "m_editormain12main_topi_lan"); }; // 2. 绑定滚动链接事件 const bindScrollLinks = () => { const titleList = document.getElementById("fixed_tab_titlelist"); const menuMain = document.getElementsByClassName("m_editormain12main")[0]; const links = document.querySelectorAll('.fixed_tab_a'); links.forEach(linkElement => { if (linkElement) { linkElement.addEventListener("click", async (e) => { e.preventDefault(); e.stopPropagation(); // 先隐藏菜单 if (menuMain) menuMain.style.display = "none"; if (titleList) titleList.style.display = "none"; // 获取目标元素的 ID const targetId = linkElement.getAttribute('href').substring(1); const targetElement = document.getElementById(targetId); // 等待 DOM 更新 await new Promise(resolve => requestAnimationFrame(resolve)); // 滚动到目标位置 if (targetElement) { targetElement.scrollIntoView({ behavior: "smooth", block: "start" }); } }); } }); }; // 3. 绑定关闭按钮事件 const bindCloseButton = () => { const closeButton = document.querySelector(".phpgenera_Details_mainR1_close"); const container = document.querySelector(".phpgenera_Details_mainR1"); if (closeButton && container) { closeButton.addEventListener("click", (event) => { event.preventDefault(); container.style.display = "none"; }); } }; // 4. 初始化菜单交互功能 const initMenuInteraction = () => { const menuGroupElements = document.querySelectorAll('.layui-menu-item-group'); menuGroupElements.forEach(menuItem => { menuItem.addEventListener('click', function(event) { if (event.target.closest('.m_menusnames')) { return; } this.classList.toggle('layui-menu-item-down'); this.classList.toggle('layui-menu-item-up'); const subMenuContainer = this.querySelector('.m_menusnames'); const icon = this.querySelector('.layui-icon'); if (subMenuContainer && icon) { if (this.classList.contains('layui-menu-item-down')) { subMenuContainer.style.display = 'block'; icon.classList.remove('layui-icon-down'); icon.classList.add('layui-icon-up'); } else { subMenuContainer.style.display = 'none'; icon.classList.remove('layui-icon-up'); icon.classList.add('layui-icon-down'); } } }); }); }; // 5. 初始化 layui 功能 const initLayui = () => { if (typeof layui !== 'undefined') { layui.use(function () { var util = layui.util; if (util && util.fixbar) { util.fixbar({ on: { mouseenter: function (type) { if (layer && layer.tips) { layer.tips(type, this, { tips: 4, fixed: true, }); } }, mouseleave: function (type) { if (layer && layer.closeAll) { layer.closeAll("tips"); } }, }, }); } }); } }; // 执行所有初始化函数 bindMenuEvents(); bindScrollLinks(); bindCloseButton(); initMenuInteraction(); initLayui(); }); </script></body></html>