太棒的插件了!
只有一个问题,有没有办法只在“分类”页面隐藏房源广告?或者只在分类框的底部显示它?
您好 ![]()
我最近为我的网站启用了广告插件,目的是展示内部广告。
我已按照 内部广告模板 主题中的建议添加了内部广告代码。
但是,它在移动/响应式版本上一直与我主题的其余 CSS 样式冲突。
看起来类别框的容器宽度突然超出了屏幕大小。
这是我正在使用的 CSS 代码:
.banner-ad {
display: flex;
justify-content: center; /* 水平居中内容 */
align-items: center; /* 在广告内垂直居中内容 */
clear: both;
width: calc(#{$topic-body-width} + #{$topic-avatar-width} + (#{$topic-body-width-padding} * 2)); /* 用于居中的显式宽度 */
max-width: 100%; /* 确保它不会超出容器宽度 */
box-sizing: border-box;
margin: 15px auto; /* 居中广告并在上方和下方添加 15px 的边距 */
text-align: center; /* 居中内联元素,例如图像 */
img {
display: block;
margin: 0 auto; /* 在广告内居中图像 */
max-width: 100%; /* 确保图像缩放到广告宽度 */
height: auto; /* 保持纵横比 */
max-height: 200px; /* 设置最大高度以限制图像 */
object-fit: contain; /* 确保图像按比例缩放 */
border-radius: 10px; /* 将圆角半径设置为 10px */
&.desktop {
display: block;
}
&.mobile {
display: none;
}
}
}
@media only screen and (max-width: 100px) {
.banner-ad {
img.desktop, p {
display: none;
}
img.mobile {
display: block;
margin: 0 auto; /* 居中移动端图像 */
max-width: 80%; /* 确保移动端图像缩放到容器宽度 */
height: auto; /* 保持纵横比 */
border-radius: 10px; /* 也为移动端图像设置圆角 */
}
}
}
有什么建议如何解决这个问题吗?