Html 如何仅链接图像而不是链接到整行
链接到它链接整行而不仅仅是我代码中的图像Html 如何仅链接图像而不是链接到整行,html,css,ruby-on-rails,Html,Css,Ruby On Rails,链接到它链接整行而不仅仅是我代码中的图像 <div class="logo"><h1><%= link_to root_path do %><%= image_tag "v.jpg",id:"second"%><% end %> <span id="margin"><%= image_tag "AppleNeon.jpg"
<div class="logo"><h1><%= link_to root_path do %><%= image_tag "v.jpg",id:"second"%><% end %> <span id="margin"><%= image_tag "AppleNeon.jpg",id:"third"%> <%= image_tag "AndroidNeon.jpg",id:"third"%> </span></h1> </div>
您的
元素将是100%,因此整行都是链接。如果你把链接放在
之外,那么只有图像才是链接。你能分享html代码吗?我真的不知道你的意思。这似乎是一个标记问题,而不是样式问题。我需要将图像链接到根路径。我的代码将整行链接到根路径
.logo{
margin-top: -10px;
margin-bottom: -20px;
font-weight: 900 !important;
background-color: black;
position: fixed;
width: 100%;
z-index:300;
}
.logo a{
font-family: "Product Sans Bold";
font-size: 48px;
font-weight: 900 !important;
color: white;
}
.logo a:hover{
text-decoration: none;
}
.logo a:active{
text-decoration: none;
}
#second{
width: 90px;
display: block;
margin-left: auto;
margin-right: auto;
}
.logo #third{
height: 60px;
padding: 5px;
}
#margin{
float: right;
margin-top: -67px !important;
padding: 2px;
padding-right: 40px;
}