[英]HTML div end tag seen too early closing error
我剛開始練習 HTML 和一些 CSS,在處理我正在參加的在線課程中的任務時,我遇到了關閉div
的問題我在 css 上創建了 a.section3
font-family: 'Handlee', cursive;
font-size: 13pt;
background-color: #fff;
padding: 15px;
margin-bottom: 10px;
border-radius: 10px;
在<body>
上,我創建了一個帶有ul
的span
,其中包含內部文本和圖像以及a href
,結果看起來符合預期。
但是,在嘗試關閉div
時出現以下錯誤```結束標記(表單)太早了。 預期的其他結束標記。
代碼如下;
<div class="section2">
<h4><span>COMPLETED COURSES</span></h4>
<ul>
<li>
HTML on <strong>SoloLearn</strong> - <a href="https://www.sololearn.com/Certificate/1014-6538353/pdf/"> <small>link to certificate</small></a>
</li>
<a href="https://www.sololearn.com/Certificate/1014-6538353/pdf/" add target="_blank">
<img src="https://www.sololearn.com/Certificate/HTML/jpg/" width="100px" height="65px" alt="">
</a>
<li>
SQL on <strong>SoloLearn and Pluralsight</strong> - <a href="https://www.sololearn.com/Certificate/1014-6538353/pdf/">
<small>link to certificate</small></a>
</li>
<a href="https://www.sololearn.com/Certificate/1014-6538353/pdf/" add target="_blank">
<img src="https://www.sololearn.com/Certificate/HTML/jpg/" width="100px" height="65px" alt=""></a>
<!--error line--> </div>
我盡力了,請指教。
謝謝你。
您沒有關閉<ul>
標簽。 您應該在</div>
之前插入</ul>
標簽。
<div class="section2">
<h4><span>COMPLETED COURSES</span></h4>
<ul>
<li>
HTML on <strong>SoloLearn</strong> -
<a href="https://www.sololearn.com/Certificate/1014-6538353/pdf/">
<small>link to certificate</small></a
>
</li>
<a
href="https://www.sololearn.com/Certificate/1014-6538353/pdf/"
add
target="_blank"
>
<img
src="https://www.sololearn.com/Certificate/HTML/jpg/"
width="100px"
height="65px"
alt=""
/>
</a>
<li>
SQL on <strong>SoloLearn and Pluralsight</strong> -
<a href="https://www.sololearn.com/Certificate/1014-6538353/pdf/">
<small>link to certificate</small></a
>
</li>
<a
href="https://www.sololearn.com/Certificate/1014-6538353/pdf/"
add
target="_blank"
>
<img
src="https://www.sololearn.com/Certificate/HTML/jpg/"
width="100px"
height="65px"
alt=""
/></a>
</ul>
<!--error line-->
</div>
首先,在<ul>
中只能有多個<li>
元素。 在您的代碼中,您的<a>
元素是您的<li>
的兄弟姐妹,請嘗試將它們放在里面。
然后你忘了關閉你的<ul>
標簽!
我對您的建議是保持代碼縮進,這樣會更容易注意到丟失的標簽。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.