#adventureIcon {
background-image: url("../icons/Kayak01.png");
width: 50px;
height: 50px;
z-index: 1;
color: red;
background-repeat: no-repeat;
}
<li class="menuItem">
<a class="icon_navigation" href="#adventure" id="adventure">
<i class="iconNav" id="adventureIcon"> </i>
<span class="icon_name">
Adventure
</span>
</a>
</li>
答案 0 :(得分:0)
如果您的路径正确,则可以向您的班级添加显示块,它将以正确的高度和宽度显示:
#adventureIcon {
background: url("https://www.rei.com/content/dam/images/Expert%20Advice/Migration/HeroImages/Van_Dragt_092217_1030_kayaking_basics_lg.jpg");
width: 50px;
height: 50px;
z-index: 1;
color: red;
background-repeat: no-repeat;
display: block;
}
#adventureIcon2 {
background: url("https://www.rei.com/content/dam/images/Expert%20Advice/Migration/HeroImages/Van_Dragt_092217_1030_kayaking_basics_lg.jpg");
width: 50px;
height: 50px;
z-index: 1;
color: red;
background-repeat: no-repeat;
}
<li class="menuItem">
<a class="icon_navigation" href="#adventure" id="adventure">
<i class="iconNav" id="adventureIcon"></i>
<div class="iconNav"></div>
<span class="icon_name">
Adventure
</span>
</a>
</li>
<li class="menuItem">
<a class="icon_navigation" href="#adventure" id="adventure2">
<i class="iconNav" id="adventureIcon2"></i>
<div class="iconNav"></div>
<span class="icon_name">
Adventure
</span>
</a>
</li>