我有以下代码,其中有一个带有箭头 hack 的按钮。唯一的问题是我想让它在状态栏上显示链接。一键不实现。我如何将其转换为 href 链接并仍然能够保留该箭头?这是我的代码:
HTML:
<button type="button" class="btn-lg btn-default my-button my-button-active">My Button</button>
CSS:
.my-button {
color: #fff ;
background-color: #444346;
font-size:15px;
padding: 20px 0px;
border:none;
margin-right:20px;
position: relative;
outline:0;
width:31%;
}
.my-button-active:after {
content:'';
position: absolute;
top: 100%;
left: 50%;
margin-left: -10px;
width: 0;
height: 0;
border-top: solid 7px #444346;
border-left: solid 7px transparent;
border-right: solid 7px transparent;
}
.my-button-active:hover:after {
content:'';
position: absolute;
top: 100%;
left: 50%;
margin-left: -10px;
width: 0;
height: 0;
border-top: solid 7px #e6e6e6;
border-left: solid 7px transparent;
border-right: solid 7px transparent;
}
最佳答案
非常简单。只需将按钮转换为 a 并添加 display: block;
或 display: inline-block;
到类 .my-button。
关于html - 将 HTML 按钮转换为链接的最佳方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30415071/