jquery - 内容在屏幕宽度 659px 处消失

标签 jquery html css

我如何维护控制背景的媒体查询以保持响应并适应浏览器边缘到边缘,同时不丢失 .content & img in #flexiselDemo3 at width 659px .content#flexiselDemo3 中的 img 消失了吗?

https://codepen.io/fjenpen/pen/pROPov

body {
    text-align: center;
    text decoration: none;
    color: #ffffff;
    font-family: arial;
    margin: 0px 0px 0px 0px;
}
@media only screen and (max-width: 658px) {
    .bg {
        height: 100%;
        width: auto;
        background-image: url("http://media.istockphoto.com/photos/repairing-lawn-    mower-engine-picture-id500782948");
        background-repeat: no-repeat;
        margin: 0px 0px 0px 0px;
        padding: 0;
        display: inline-block;
        text-align: center;
        text decoration: none;
        color: #ffffff;
        font-family: arial;
        margin: 0px 0px 0px 0px;
    }
}
@media only screen and (min-width: 659px) {
    .bg {
        width: 100%;
        display: inline-block;
        background-image: url("http://media.istockphoto.com/photos/repairing-lawn-    mower-engine-picture-id500782948");
        background-repeat: no-repeat;
        background-size: 100% auto;
        text-align: center;
        text decoration: none;
        color: #ffffff;
        font-family: arial;
        margin: 0px 0px 0px 0px;
    }
}

最佳答案

你的问题的核心是你给 .bg 显示 inline-block

@media only screen and (max-width: 658px) {
    .bg {
        ...
        display: inline-block; <- get rid of this
        ...

关于jquery - 内容在屏幕宽度 659px 处消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42123027/

相关文章:

javascript - 用从源代码中删除代码代替显示无

javascript - 在 DOM 加载之前使用 Js/jQuery 定位 iframe

javascript - 在插入之前处理 html 字符串

javascript多个事件未触发

javascript - 在鼠标进入/离开时展开和折叠导航,REACT

html - Bootstrap 导航栏 - 无法更改字体颜色

javascript - 迭代 "subobjects"的 javascript 对象属性

javascript - 如何使用jquery获取多个标签值并将其插入数组

html - 即图像链接中的边框(未由样式边框 :none) 修复

html - antd 按钮换行文字