下载带有 <input> html 格式标签的文件



我目前正在为我的初创公司Virtual Business制作一个网站,我正试图让<input>标签让我下载一个文件。

  • 当前代码,我从其他堆栈溢出帖子中使用过

<input type="button" value="Download" classs="buyButton"onclick="href='google.com'">

我已经布局了所有的CSS,按钮是功能性的,但只需要看起来像最右边的按钮

像这样添加CSS

.buyButton {
background-color: #C0C0C0;
border: none;
color: white;
padding: 10px 50px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}
.buyButton:hover {
background-color: black;
color: white;
}
<input type="button" value="Download" class="buyButton" onclick="location.href='google.com'">

Bootstrap有各种不同的按钮可供选择
要使按钮显示在最右侧,请使用css样式float:right;https://getbootstrap.com/docs/4.0/components/buttons/

<button type="button" class="btn--download" onclick="location.href='stackoverflow.com'">Download</button
.btn--download {
border-radius: 7px;
box-shadow: none;
color: black;
cursor: pointer;
padding: 10px 15px;
transition: ease .4s background-color, ease .4s color .4s
}
.btn--download:hover {
background-color: black;
color: white;
}

最新更新