如何制作 bootstrap 按钮,点击重定向到特定页面
How to make the bootstrap button,when clicked to redirect to a specific page
这是我的代码
<div class="btn btn-default btn-lg btn-block for-get-button">
<%= link_to "Get this box for", download_picture_path(@gig), :target => "_blank" %> <%= @gig.pointsneeded %> points
</div>
为了澄清上面的第一个代码,将用户重定向到我需要的地方。
<%= link_to "Get this box for", download_picture_path(@gig), :target => "_blank" %>
第二个代码,只显示需要的点数
<%= @gig.pointsneeded %>
单词“points”只是代码后面的单词。
这是所有代码的 css:
.btn.btn-default.btn-lg.btn-block.for-get-button {
background-color: #000000;
text-color: #00FFFF;
a:link {
color: #00FFFF;
}
a:visited {
color: #00FFFF;
}
a:hover {
color: #00FFFF;
}
a:active {
color: #00FFFF;
}
color: #00FFFF;
}
Question: how to make this whole code when clicked on any part/side of the button that is formed around it,when clicked it
should redirect to download_picture_path(@gig).Because now,on hover over the "Get this box for" an underline appears,and i have to click EXACTLY on "Get this box for" to get redirected where i need,when i should be able to click anywhere in the button to get redirected.
希望我说清楚了。
这应该适合你:
<%= link_to "Get this box for #{@gig.pointsneeded} points", download_picture_path(@gig), :target => "_blank", class: "btn btn-default btn-lg btn-block for-get-button" %>
虽然我的代码可能不在样式上,因为我取出 div 并将其放在 link_to 上。但应该可以解决问题
这是我的代码
<div class="btn btn-default btn-lg btn-block for-get-button">
<%= link_to "Get this box for", download_picture_path(@gig), :target => "_blank" %> <%= @gig.pointsneeded %> points
</div>
为了澄清上面的第一个代码,将用户重定向到我需要的地方。
<%= link_to "Get this box for", download_picture_path(@gig), :target => "_blank" %>
第二个代码,只显示需要的点数
<%= @gig.pointsneeded %>
单词“points”只是代码后面的单词。
这是所有代码的 css:
.btn.btn-default.btn-lg.btn-block.for-get-button {
background-color: #000000;
text-color: #00FFFF;
a:link {
color: #00FFFF;
}
a:visited {
color: #00FFFF;
}
a:hover {
color: #00FFFF;
}
a:active {
color: #00FFFF;
}
color: #00FFFF;
}
Question: how to make this whole code when clicked on any part/side of the button that is formed around it,when clicked it should redirect to download_picture_path(@gig).Because now,on hover over the "Get this box for" an underline appears,and i have to click EXACTLY on "Get this box for" to get redirected where i need,when i should be able to click anywhere in the button to get redirected.
希望我说清楚了。
这应该适合你:
<%= link_to "Get this box for #{@gig.pointsneeded} points", download_picture_path(@gig), :target => "_blank", class: "btn btn-default btn-lg btn-block for-get-button" %>
虽然我的代码可能不在样式上,因为我取出 div 并将其放在 link_to 上。但应该可以解决问题