PHP广告弹出提示框:带图片,上下循环移动
以下是一个使用PHP写的广告弹出提示框的示例代码,它可以显示图片并上下循环移动:
<!DOCTYPE html>
<html>
<head>
<style>
.ad-container {
position: fixed;
bottom: 0;
width: 100%;
background-color: #f0f0f0;
padding: 10px;
overflow: hidden;
animation: adMove 10s linear infinite;
}
@keyframes adMove {
0% { bottom: -200px; }
50% { bottom: 0; }
100% { bottom: -200px; }
}
.ad-container img {
max-width: 100%;
max-height: 100px;
}
</style>
</head>
<body>
<div class="ad-container">
<?php
// 在此处插入你的广告图片链接
$adImages = [
'https://example.com/ad1.jpg',
'https://example.com/ad2.jpg',
'https://example.com/ad3.jpg'
];
foreach ($adImages as $image) {
echo '<img src='' . $image . '' alt='Advertisement'>';
}
?>
</div>
</body>
</html>
代码使用CSS的position: fixed属性将广告容器固定在页面底部,并通过animation属性和@keyframes规则实现上下循环移动的效果。你只需要在$adImages数组中添加你的广告图片链接,即可在页面底部展示可以上下循环移动的广告提示框。
原文地址: https://www.cveoy.top/t/topic/o7v2 著作权归作者所有。请勿转载和采集!