网站广告自适应代码区块 区块
宝总 9天前

    <style>
  .ad-container {
            display: flex;
            flex-wrap: wrap;
            gap: 2px;
            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: 1px;
            right: 10px;
            background-color: rgba(0, 0, 0, 0.6);
            color: white;
            padding: 1px 1px;
            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="https://qqq.gtimg.cn/music/photo_new/T053M001001s5Ktc19kWmf.jpg" alt="广告1">
            <div class="ad-label">广告</div>
        </div>
        <div class="ad">
            <img src="https://qqq.gtimg.cn/music/photo_new/T053M001001s5Ktc19kWmf.jpg" alt="广告2">
            <div class="ad-label">广告</div>
        </div>
    </div>
 
最新回复 (0)