|
|
话不多说,直接分享
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.bdwang {
background: #2d1a0f;
min-height: 100px;
height: 100px;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', sans-serif;
padding: 10px;
}
/* 广告条:固定高度100px,宽高比≈20:1 (max-width=2000px) */
.banner {
width: 100%;
max-width: 2000px; /* 100px * 20 = 2000px */
height: 100px; /* 严格100px */
background: linear-gradient(145deg, #dc2626 0%, #f59e0b 70%, #fbbf24 100%);
background-image:
repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 0px, rgba(255, 255, 255, 0.15) 6px, transparent 6px, transparent 12px),
radial-gradient(circle at 10% 30%, rgba(255, 215, 0, 0.7) 0%, transparent 30%),
radial-gradient(circle at 25% 80%, #fff6b0 0%, transparent 35%),
radial-gradient(circle at 75% 20%, #ffdd77 0%, transparent 40%),
radial-gradient(circle at 90% 70%, #fbbf24 0%, transparent 45%);
border-radius: 20px;
box-shadow: 0 10px 20px rgba(220, 38, 38, 0.5), 0 0 0 2px #ffd966 inset, 0 0 0 4px #b45309 inset;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20px 0 25px;
color: white;
position: relative;
overflow: hidden;
}
/* 星星背景 */
.banner::before {
content: '';
position: absolute;
inset: 0;
background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" opacity="0.2"><path fill="%23ffe484" d="M20 15l5 10-10 3 8 7-2 11 9-5 9 5-2-11 8-7-10-3 5-10z"/><path fill="%23ffb347" d="M70 25l3 7-7 2 5 5-1 7 6-3 6 3-1-7 5-5-7-2 3-7z"/><path fill="%23fff2b5" d="M45 70l2 5-5 1 4 4-1 6 4-2 4 2-1-6 4-4-5-1 2-5z"/></svg>') repeat;
background-size: 70px 70px;
z-index: 0;
pointer-events: none;
mix-blend-mode: overlay;
}
/* 流光效果 (适当减弱避免遮挡文字) */
.banner::after {
content: '';
position: absolute;
top: -20%;
left: -5%;
width: 35%;
height: 160%;
background: linear-gradient(90deg, rgba(255,255,255,0.4), rgba(255,240,150,0.2), transparent);
transform: rotate(15deg);
z-index: 1;
filter: blur(8px);
animation: shine 5s infinite alternate ease-in-out;
}
@keyframes shine {
0% { left: -15%; opacity: 0.3; }
100% { left: 30%; opacity: 0.8; }
}
/* 文字层均在上层 */
.banner-left, .banner-center, .banner-right {
z-index: 5;
display: flex;
align-items: center;
white-space: nowrap;
text-shadow: 1px 1px 2px rgba(150, 50, 0, 0.5);
}
/* 左侧品牌区域 */
.banner-left {
flex-direction: column;
align-items: flex-start;
justify-content: center;
line-height: 1;
gap: 0px;
}
.brand {
font-size: clamp(22px, 5vh, 36px); /* 100px高度下最大36px */
font-weight: 900;
letter-spacing: 1px;
color: #ffecaa;
text-shadow: 2px 2px 0 #b45309, 0 0 12px #ffd700;
transform: scaleY(1.05);
}
.sub {
font-size: clamp(12px, 2vh, 18px);
font-weight: 700;
background: #c2410c;
padding: 4px 14px 6px 12px;
border-radius: 30px;
box-shadow: 0 3px 6px rgba(160, 60, 0, 0.6), 0 0 0 1px #fde68a inset;
color: #fff9e6;
white-space: nowrap;
backdrop-filter: blur(2px);
margin-left: 2px;
}
/* 中间核心卖点 */
.banner-center {
font-size: clamp(14px, 2.2vh, 22px);
font-weight: 700;
background: rgba(0, 0, 0, 0.2);
backdrop-filter: blur(4px);
padding: 4px 16px;
border-radius: 40px;
border: 1px solid #fde68a;
box-shadow: 0 0 15px #ffb703;
gap: 8px;
margin: 0 10px;
}
.center-item {
display: flex;
align-items: center;
gap: 4px;
}
.icon {
font-size: 1.2em;
filter: drop-shadow(0 1px 3px gold);
}
.divider {
color: #ffdf8c;
font-weight: 400;
font-size: 1.4em;
transform: translateY(-1px);
}
/* 右侧电话按钮 */
.banner-right {
background: white;
border-radius: 40px;
padding: 5px 20px;
color: #b91c1c;
font-weight: 800;
font-size: clamp(16px, 2.8vh, 26px);
box-shadow: 0 0 0 2px #fbbf24, 0 5px 0 #b45309, 0 8px 15px rgba(220, 38, 38, 0.6);
transition: all 0.2s ease;
cursor: default;
white-space: nowrap;
border: 1px solid #ffd966;
flex-shrink: 0;
}
.banner-right:hover {
transform: translateY(-1px);
box-shadow: 0 0 0 2px #fde68a, 0 7px 0 #b45309, 0 12px 20px #dc2626;
background: #fff2b5;
}
.phone {
display: flex;
align-items: center;
gap: 6px;
}
.phone span {
font-size: 0.7em;
background: #fee7a0;
color: #b45309;
padding: 2px 10px 2px 8px;
border-radius: 30px;
margin-left: 5px;
font-weight: 600;
box-shadow: inset 0 -1px 3px rgba(0,0,0,0.1);
}
/* 漂浮光点 (不影响高度) */
.star1, .star2, .star3 {
position: absolute;
background: radial-gradient(circle, #fffacd, #ffd700);
width: 12px;
height: 12px;
border-radius: 50%;
filter: blur(3px);
opacity: 0.7;
z-index: 2;
pointer-events: none;
}
.star1 { top: 15%; left: 5%; }
.star2 { bottom: 15%; right: 8%; width: 16px; height: 16px; }
.star3 { top: 25%; right: 20%; width: 10px; height: 10px; }
/* 窄屏优化:确保文字不溢出,隐藏次要元素 */
@media (max-width: 1000px) {
.banner {
padding: 0 15px;
}
.brand {
font-size: 28px;
}
.sub {
font-size: 12px;
padding: 2px 10px;
}
.banner-center {
font-size: 14px;
padding: 3px 12px;
}
.banner-right {
font-size: 20px;
padding: 4px 16px;
}
}
@media (max-width: 800px) {
.phone span {
display: none; /* 隐藏“抢位”标签 */
}
.banner-center {
padding: 2px 10px;
}
}
@media (max-width: 700px) {
.banner-center .divider {
display: none; /* 隐藏分隔符 */
}
.banner-center {
gap: 4px;
}
}
@media (max-width: 550px) {
.brand {
font-size: 24px;
}
.sub {
font-size: 10px;
padding: 1px 8px;
}
.banner-center {
font-size: 12px;
padding: 2px 8px;
}
.banner-right {
font-size: 16px;
padding: 3px 12px;
}
}
</style>
<div class="bdwang">
<div class="banner">
<!-- 喜庆小星星 -->
<div class="star1"></div>
<div class="star2"></div>
<div class="star3"></div>
<!-- 左侧:贝帝王 + 淮安信息学奥赛 -->
<div class="banner-left">
<div class="brand">贝帝王</div>
<div class="sub"><a style="color:white" href="https://www.bdworld.cn/">淮安信息学奥赛培训班</a></div>
</div>
<!-- 中间:大学教授全程授课 + CSP-J/S 编程 -->
<div class="banner-center">
<span class="center-item">
<span class="icon">🎓</span>
<span>大学教授全程授课</span>
</span>
<span class="divider">|</span>
<span class="center-item">
<span class="icon">💻</span>
<span>CSP-J/S C++编程</span>
</span>
</div>
<!-- 右侧:咨询电话 15152345777 -->
<div class="banner-right">
<div class="phone">
<span>📞</span> 15152345777
<span>抢位</span>
</div>
</div>
</div>
</div>
|
|