首页 > 解决方案 > 如何使这个超链接响应。谢谢?

问题描述

这就是我的 HTML:

<div class="responsive">
<a href="" 
target="_blank"><img alt="instalink" src=""
onmouseover="this.src=''"
onmouseout="this.src=''"/> </a>

CSS:

.responsive {
    max-width: 100%;
    height: auto;
}

多谢你们。

标签: cssresponsive

解决方案


您需要为其创建媒体查询。您的规则与屏幕尺寸无关。尝试这个:

.responsive {
    max-width: 100%;
    height: auto;
}

/* On screens that are 992px or less, set the background color to blue */
@media screen and (max-width: 992px) {
    .responsive {
        /*Your rule*/
    }
}

/* On screens that are 600px or less, set the background color to olive */
@media screen and (max-width: 600px) {
    .responsive {
        /*Your rule*/
    }
}

推荐阅读