演示:
![图片[1]-ErphpDown下载按钮代码-回忆博客](http://www.aih0.cn/wp-content/uploads/2026/03/699982ce1f6cae6d41e83392.png)
代码:
<div id="posts-pay" class="pay-box zib-widget paid-box order-type-2">
<div class="box-body relative">
<div class="hidden-box show">
<div class="hidden-text"><i class="fa fa-download mr6" aria-hidden="true"></i>资源下载</div>
<div>
<div class="but-download"><a href="下载地址" target="_blank" class="mr10 but b-theme lanzou" style="overflow: hidden;position: relative"><i class="fa fa-download" aria-hidden="true"></i>本地下载</a></div>
</div>
</div>
</div>
</div>
CSS:
/* ===== 基础变量(必要) ===== */
:root {
--theme-color: #f04494;
--focus-color: var(--theme-color);
--main-bg-color: #fff;
--main-color: #4e5358;
--muted-color: #777;
--main-radius: 8px;
--main-border-color: rgba(50, 50, 50, 0.06);
--main-shadow: rgba(116, 116, 116, 0.08);
}
/* ===== 基础工具类 ===== */
.relative { position: relative; }
.mr6 { margin-right: 6px; }
.mr10 { margin-right: 10px; }
/* ===== Font Awesome 基础 ===== */
.fa {
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
}
.fa-download:before { content: "f019"; }
/* ===== 按钮系统 ===== */
.but {
border-radius: 4px;
display: inline-block;
transition: .15s;
border: 1px solid transparent;
vertical-align: middle;
padding: .3em .6em;
text-align: center;
font-weight: 400;
background: var(--this-bg);
color: var(--this-color);
--this-bg: rgba(136, 136, 136, .1);
--this-color: #888;
line-height: 1.44;
cursor: pointer;
}
.but .fa { margin-right: .25em; }
.but:hover { opacity: .8; }
/* 主题色按钮 */
.b-theme {
--this-bg: var(--focus-color);
--this-color: #fff;
}
/* 蓝奏云特定样式 */
.but.lanzou {
background: #f37526;
color: #fff;
}
/* ===== 小部件容器 ===== */
.zib-widget {
clear: both;
background: var(--main-bg-color);
padding: 15px;
box-shadow: 0 0 10px var(--main-shadow);
border-radius: var(--main-radius);
margin-bottom: 20px;
}
.box-body { padding: 15px; }
/* ===== 付费/下载盒子 ===== */
.pay-box {
font-size: 14px;
position: relative;
overflow: hidden;
line-height: 1.4;
}
.paid-box { padding: 0!important; }
/* 订单类型特定样式(保留渐变背景) */
.order-type-2 .pay-tag {
--this-bg: linear-gradient(135deg, #ff5e7f 30%, #ff967e 100%);
}
/* ===== 隐藏/显示盒子 ===== */
.hidden-box {
padding: 10px;
margin: 20px 0;
border: 1px dashed var(--focus-color);
border-radius: var(--main-radius);
position: relative;
}
.hidden-box.show { padding-top: 35px; }
.hidden-text {
color: var(--focus-color);
padding: 10px;
text-align: center;
display: block;
}
.hidden-box.show .hidden-text {
padding: 3px 10px;
font-size: 13px;
top: 0;
border-radius: 0 0 8px 0;
line-height: 1.4;
z-index: 1;
left: 0;
position: absolute;
border-bottom: 1px dashed var(--focus-color);
border-right: 1px dashed var(--focus-color);
}
/* ===== 下载按钮区域 ===== */
.but-download {
padding: 15px 10px 0 10px;
display: inline-block;
width: 50%;
vertical-align: top;
}
.but-download .but {
min-width: 130px;
overflow: hidden;
position: relative;
}
.but-download .but .fa,
.but-download .but > .fa {
margin-right: 1em;
}
/* ===== 响应式(移动端适配) ===== */
@media (max-width: 640px) {
.pay-box { padding: 10px; }
.but-download { width: auto; }
.but-download .but { width: 100%; }
}
@media (max-width: 480px) {
.pay-box .but-download { width: auto; }
}
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END




暂无评论内容