Bootstrap 按钮悬停问题

当我将鼠标悬停在我网站上的引导按钮上时,它不会在 chrome 左下角显示链接。我在这里错过了什么吗?这是我目前用于按钮的代码。

<button type="button" class="btn btn-primary navbar-btn m-l-15 m-r-15" onclick="location.href='{$relative}/upload'">{translate c='menu.upload'}</button>


ibeautiful
浏览 273回答 3
3回答

开满天机

您可以使用具有<a>按钮角色的元素并将其样式设置为看起来像按钮,但使用的类与您当前使用的类相同。唯一需要注意的是,您应该确定在您的情况下使用的正确元素 - 例如 - 一个链接(一个元素)应该将您导航到一个新的位置或上下文 - 而如果按钮在相同的位置/上下文。此外 - 如果 botton 具有导航到所需位置的其他功能 - 您将需要重新引入点击处理程序并应用逻辑来执行该功能。<a&nbsp;&nbsp; href="{$relative}/upload"&nbsp;&nbsp; role="button"&nbsp;&nbsp; class="btn btn-primary navbar-btn m-l-15 m-r-15">{translate c='menu.upload'}</a>

Helenr

首先将margin-leftandmargin-right从m-l-15andm-r-15改为ml-1and&nbsp;mr-1。在 bootstrapml和mrclass 中只取 1 到 5 的值。在 class 中它不取值超过 5。你必须把它交给css。试试这个:&nbsp;<a&nbsp;role="button"&nbsp;class="btn&nbsp;btn-primary&nbsp;navbar-btn&nbsp;ml-5&nbsp;mr-5"&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;href="{$relative}/upload">{translate&nbsp;c='menu.upload'}</a>

温温酱

你可以把你的链接放在下面,它可能会解决你的问题<a href="your_link_here">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;<button type="button" class="btn btn-primary navbar-btn ml-5 mr-5">&nbsp; &nbsp; &nbsp; {translate c='menu.upload'}&nbsp; &nbsp;</button></a>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript