预览如图,手机端为自适应两行展示 使用方式:代码粘贴至合适的位置即可!
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>横板自适应双广告图片</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
background-color: #333;
}
.ad-container {
display: flex;
flex-wrap: wrap;
gap: 20px;
justify-content: center;
}
.ad {
position: relative;
width: calc(50% - 10px);
min-width: 300px;
overflow: hidden;
}
.ad img {
width: 100%;
height: auto;
display: block;
}
.ad-label {
position: absolute;
top: 10px;
right: 10px;
background-color: rgba(0, 0, 0, 0.6);
color: white;
padding: 5px 10px;
border-radius: 3px;
font-size: 12px;
}
@media (max-width: 768px) {
.ad {
width: 100%;
}
}
</style>
</head>
<body>
<div class="ad-container">
<div class="ad">
<img src="gg.png" alt="广告1">
<div class="ad-label">广告</div>
</div>
<div class="ad">
<img src="gg.png" alt="广告2">
<div class="ad-label">广告</div>
</div>
</div>
![图片[1]|自适应网站图片广告横幅代码(带广告标识)|不死鸟资源网](https://www.busi.net/wp-content/uploads/2025/03/20250318215120325-image-1024x500.png)
本站资源均为作者提供和网友推荐收集整理而来,仅供学习和研究使用,请在下载后24小时内删除,谢谢合作!
THE END