HTML如何添加多张图片?第二张图片被忽略不显示问题求助
问题修复点
- 标签嵌套顺序错误:行内标签
<i>、<b>必须在外层<p>标签闭合前完成闭合,原有代码中<p><i>内容</p></i>的写法不符合HTML语法规范,会触发DOM解析异常。 - 首个
<h2>标签未正确闭合:原有代码中首个<h2>的结束标签写成了<h2>,缺少闭合标识/,未闭合的块级元素会导致浏览器对后续所有内容的结构解析错乱,这是第二张图片无法正常加载的核心原因。 - 图片路径包含空格:建议将路径中的空格替换为URL编码
%20,避免部分浏览器无法正确识别本地路径。
修正后完整代码
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="My mech inventions/arts" content="Machine part 1.0\nHead & Neck"> <title>Josiah's Blueprints</title> </head> <body style="background-color:black"> <h2 style="color:white">Machine Part 1.0</h2> <h2 style="color:maroon;"><b>Head & Neck</b></h2> <hr/> <p style="color:white"><i>Fig 1.0</i></p> <p style="color:white"><b>Front View</b></p> <img width="1300" src="/home/princesspriest/KRITA/Mech%20blueprints/Mech%20blueprint%20(head%20&%20neck%20Front%20view)%20.png" alt="Fig 1.0 front View of the mech's head and neck"/> <p style="color:white"><i>Fig 2.0</i></p> <p style="color:white"><b>Upper View</b></p> <img width="1300" src="/home/princesspriest/KRITA/Mech%20blueprints/Mech%20blueprint%20(head%20&%20neck%20upper%20view)%20.png" alt="Fig 2.0 upper view of the mech's head and neck"/> </body> </html>
内容的提问来源于stack exchange,提问作者The Fear
相关产品推荐
相关产品推荐

