|
| 1 | +/* AdSense广告样式 - 优化版本 */ |
| 2 | +.adsense-container { |
| 3 | + margin: 1rem 0; |
| 4 | + padding: 0.5rem; |
| 5 | + text-align: center; |
| 6 | + background: transparent; |
| 7 | + border: none; |
| 8 | + box-shadow: none; |
| 9 | + transition: opacity 0.3s ease; |
| 10 | +} |
| 11 | + |
| 12 | +.adsense-container.hidden { |
| 13 | + display: none !important; |
| 14 | + margin: 0 !important; |
| 15 | + padding: 0 !important; |
| 16 | + height: 0 !important; |
| 17 | + min-height: 0 !important; |
| 18 | + max-height: 0 !important; |
| 19 | + width: 0 !important; |
| 20 | + min-width: 0 !important; |
| 21 | + max-width: 0 !important; |
| 22 | + overflow: hidden !important; |
| 23 | + opacity: 0 !important; |
| 24 | + visibility: hidden !important; |
| 25 | + position: absolute !important; |
| 26 | + left: -9999px !important; |
| 27 | + top: -9999px !important; |
| 28 | + z-index: -9999 !important; |
| 29 | + pointer-events: none !important; |
| 30 | + user-select: none !important; |
| 31 | + transform: scale(0) !important; |
| 32 | +} |
| 33 | + |
| 34 | +/* 强制隐藏iframe - 确保iframe不占用空间 */ |
| 35 | +.adsense-container.hidden iframe { |
| 36 | + display: none !important; |
| 37 | + width: 0 !important; |
| 38 | + height: 0 !important; |
| 39 | + border: none !important; |
| 40 | + margin: 0 !important; |
| 41 | + padding: 0 !important; |
| 42 | + overflow: hidden !important; |
| 43 | + position: absolute !important; |
| 44 | + left: -9999px !important; |
| 45 | + top: -9999px !important; |
| 46 | + z-index: -9999 !important; |
| 47 | + pointer-events: none !important; |
| 48 | + visibility: hidden !important; |
| 49 | + opacity: 0 !important; |
| 50 | + transform: scale(0) !important; |
| 51 | + clip: rect(0, 0, 0, 0) !important; |
| 52 | +} |
| 53 | + |
| 54 | +/* 强制隐藏iframe内部的body元素 */ |
| 55 | +.adsense-container.hidden iframe[src*="googlesyndication"] { |
| 56 | + display: none !important; |
| 57 | + width: 0 !important; |
| 58 | + height: 0 !important; |
| 59 | +} |
| 60 | + |
| 61 | +.adsense-ad { |
| 62 | + position: relative; |
| 63 | + text-align: center; |
| 64 | + min-height: auto; |
| 65 | + display: block; |
| 66 | +} |
| 67 | + |
| 68 | +.adsense-label { |
| 69 | + display: none; /* 隐藏广告标签 */ |
| 70 | +} |
| 71 | + |
| 72 | +/* 确保广告在内容流中正确显示 */ |
| 73 | +.adsense-container ins.adsbygoogle { |
| 74 | + display: block !important; |
| 75 | + width: 100%; |
| 76 | + height: auto; |
| 77 | + min-height: auto; |
| 78 | + border: none; |
| 79 | + overflow: visible; |
| 80 | +} |
| 81 | + |
| 82 | +/* 响应式设计 - 保持简洁 */ |
| 83 | +@media (max-width: 768px) { |
| 84 | + .adsense-container { |
| 85 | + margin: 0.75rem 0; |
| 86 | + padding: 0.25rem; |
| 87 | + } |
| 88 | +} |
| 89 | + |
| 90 | +/* 暗色模式适配 - 保持透明 */ |
| 91 | +[data-md-color-scheme="slate"] .adsense-container { |
| 92 | + background: transparent; |
| 93 | + border: none; |
| 94 | + box-shadow: none; |
| 95 | +} |
| 96 | + |
| 97 | +/* 广告加载失败时完全隐藏 */ |
| 98 | +.adsense-ad.error { |
| 99 | + display: none; |
| 100 | +} |
| 101 | + |
| 102 | +/* 确保广告不会影响页面布局 */ |
| 103 | +.adsense-container { |
| 104 | + overflow: visible; |
| 105 | + word-wrap: normal; |
| 106 | +} |
| 107 | + |
| 108 | +/* 加载状态样式 */ |
| 109 | +.adsense-container.loading { |
| 110 | + opacity: 0.7; |
| 111 | +} |
| 112 | + |
| 113 | +/* 广告加载完成后的样式 */ |
| 114 | +.adsense-container.loaded { |
| 115 | + opacity: 1; |
| 116 | +} |
| 117 | + |
| 118 | +/* 强制隐藏状态 - 最高优先级 */ |
| 119 | +.adsense-container[style*="display: none"] { |
| 120 | + display: none !important; |
| 121 | + margin: 0 !important; |
| 122 | + padding: 0 !important; |
| 123 | + height: 0 !important; |
| 124 | + min-height: 0 !important; |
| 125 | + max-height: 0 !important; |
| 126 | + width: 0 !important; |
| 127 | + min-width: 0 !important; |
| 128 | + max-width: 0 !important; |
| 129 | + overflow: hidden !important; |
| 130 | + opacity: 0 !important; |
| 131 | + visibility: hidden !important; |
| 132 | + position: absolute !important; |
| 133 | + left: -9999px !important; |
| 134 | + top: -9999px !important; |
| 135 | + z-index: -9999 !important; |
| 136 | + pointer-events: none !important; |
| 137 | + user-select: none !important; |
| 138 | + transform: scale(0) !important; |
| 139 | +} |
| 140 | + |
| 141 | +/* 强制隐藏iframe - 最高优先级 */ |
| 142 | +.adsense-container[style*="display: none"] iframe { |
| 143 | + display: none !important; |
| 144 | + width: 0 !important; |
| 145 | + height: 0 !important; |
| 146 | + border: none !important; |
| 147 | + margin: 0 !important; |
| 148 | + padding: 0 !important; |
| 149 | + overflow: hidden !important; |
| 150 | + position: absolute !important; |
| 151 | + left: -9999px !important; |
| 152 | + top: -9999px !important; |
| 153 | + z-index: -9999 !important; |
| 154 | + pointer-events: none !important; |
| 155 | + visibility: hidden !important; |
| 156 | + opacity: 0 !important; |
| 157 | + transform: scale(0) !important; |
| 158 | + clip: rect(0, 0, 0, 0) !important; |
| 159 | +} |
| 160 | + |
| 161 | +/* 特殊处理:隐藏所有可能的AdSense相关元素 */ |
| 162 | +.adsense-container.hidden *, |
| 163 | +.adsense-container[style*="display: none"] * { |
| 164 | + display: none !important; |
| 165 | + width: 0 !important; |
| 166 | + height: 0 !important; |
| 167 | + margin: 0 !important; |
| 168 | + padding: 0 !important; |
| 169 | + overflow: hidden !important; |
| 170 | + position: absolute !important; |
| 171 | + left: -9999px !important; |
| 172 | + top: -9999px !important; |
| 173 | + z-index: -9999 !important; |
| 174 | + pointer-events: none !important; |
| 175 | + visibility: hidden !important; |
| 176 | + opacity: 0 !important; |
| 177 | + transform: scale(0) !important; |
| 178 | +} |
0 commit comments