我正在尝试在我的代码中实现新的 HTML5 图片标签,但是,当遵循 W3C 关于元素的指南时,它只显示后备图像,而不是调整大小时应该显示的图像。
我不确定图片容器是否需要 CSS 样式以确保在调整大小时切换图像。
任何帮助将不胜感激!
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="Style.css">
</head>
<body>
<div id="container">
<div id="header">
</div> <!-- end of header -->
<nav>
<ul>
<li id="HomeButton">
<a href="index.html"><img id="HomeText" src="Images/Icons/HomeText.png" /></a>
</li>
<li id="WhatsWhatButton">
<a href="whatswhat.html"><img id="WhatsWhatText" src="Images/Icons/WhatsWhatText.png" /></a>
</li>
<li id="FoodFromPlantsButton">
<a href="foodfromplants.html"><img id="FoodFromPlantsText" src="Images/Icons/FoodFromPlantsText.png" /></a>
</li>
<li id="HowPlantsGrowButton">
<div id="HowPlantsGrowText">
<a href="howplantsgrow.html"><img src="Images/Icons/HowPlantsGrowText.png" /></a>
</div>
<div id="HowPlantsGrowIcon"></div>
</li>
<li id="PlantGameButton">
<a href="plantGame.html"><img id="PlantGameText" src="Images/Icons/PlantGameText.png" /></a>
</li>
</ul>
</nav> <!-- end of nav -->
<div id="page">
<div id="content">
<img class="title" src="Images/Icons/FoodFromPlantsTitle.png" width="250" height="100"/>
<picture alt="angry pirate">
<source src=Images/Icons/HomeIcon.png media="min-width:800px">
<source src=Images/Icons/FoodFromPlantsIcon.png media="min-width:480px">
<source src=Images/Icons/PlantGame.png>
<!-- fallback for browsers without support -->
<img src=Images/Icons/WhatsWhatIcon.png alt="angry pirate">
</picture>
</div> <!-- end of content -->
</div> <!-- end of page -->
<footer>
</footer> <!-- end of footer -->
</div> <!-- end of container -->
</body>
</html>