html - 如何使我的菜单具有响应性?

标签 html css

我在这里创建了一个弹出菜单:https://jsfiddle.net/8f3vLh0a/1/

我试图调整一些东西来制定一个完美的,但想知道我怎样才能让它响应。这样当您调整它的大小时,它在较小的设备上看起来会很好。

这是我的CSS:

.icon-box.home h2 { 
     z-index: -999;
     position: absolute; 
     top: 0; 
     left: 0; 
     opacity: 0; 
     background: #E74C3C; 
     line-height: 120px; 
     width: 120px; 
     -webkit-transition: all  .3s;
    -moz-transition: all .5s;
    -ms-transition: all .5s;
    -o-transition: all .5s;
    transition: all .5s;
        border-left: 3px solid #a7382d;

}

.icon-box.home a:hover h2 { 
    opacity: 1; left: 120px; margin: 0;
    text-align: center;

}

.icon-box.aboutme h2 { 
     z-index: -999;
     position: absolute; 
     top: 0; 
     left: 0; 
     opacity: 0; 
     background: #1dd0ad; 
     line-height: 120px; 
     width: 120px; 
     -webkit-transition: all  .3s;
    -moz-transition: all .5s;
    -ms-transition: all .5s;
    -o-transition: all .5s;
    transition: all .5s;
    border-left: 3px solid #0d866e;
}

.icon-box.aboutme a:hover h2 { 
    opacity: 1; left: 120px; margin: 0;
    text-align: center;

}


.icon-box.portfolio h2 { 
     z-index: -999;
     position: absolute; 
     top: 0; 
     left: 0; 
     opacity: 0; 
     background: #3498db; 
     line-height: 120px; 
     width: 120px; 
     -webkit-transition: all  .3s;
    -moz-transition: all .5s;
    -ms-transition: all .5s;
    -o-transition: all .5s;
    transition: all .5s;
    border-left: 3px solid #2177b1;
}

.icon-box.portfolio a:hover h2 { 
    opacity: 1; left: 120px; margin: 0;
    text-align: center;

}


.icon-box.blog h2 { 
     z-index: -999;
     position: absolute; 
     top: 0; 
     left: 0; 
     opacity: 0; 
     background: #f1c40f; 
     line-height: 120px; 
     width: 120px; 
     -webkit-transition: all  .3s;
    -moz-transition: all .5s;
    -ms-transition: all .5s;
    -o-transition: all .5s;
    transition: all .5s;
    border-left: 3px solid #b8960e;
}

.icon-box.blog a:hover h2 { 
    opacity: 1; left: 120px; margin: 0;
    text-align: center;

}

.icon-box.contact h2 { 
     z-index: -999;
     position: absolute; 
     top: 0; 
     left: 0; 
     opacity: 0; 
     background: #f39c12; 
     line-height: 120px; 
     width: 120px; 
     -webkit-transition: all  .3s;
    -moz-transition: all .5s;
    -ms-transition: all .5s;
    -o-transition: all .5s;
    transition: all .5s;
    border-left: 3px solid #bc780d;
}

.icon-box.contact a:hover h2 { 
    opacity: 1; left: 120px; margin: 0;
    text-align: center;

}





span.icon { display: inline-block; background: url('../img/icon-sprites.png')no-repeat;  width: 32px; height: 32px; margin: 43px 40px;}
span.icon.home { background-position: 0px 0px;}
span.icon.aboutme { background-position: -36px 0px;}
span.icon.portfolio { background-position: -72px 0px;}
span.icon.blog { background-position: -109px 0px;}
span.icon.contact { background-position: -145px 0px;}

.icon-box a {
    padding: 120px;
}

有什么想法可以让它在所有浏览器上响应吗?

JSFIDDLE 请?

注意:请勿引导

最佳答案

使用@Media查询

Media Queries CSS

或者更好地使用 Bootstrap

Bootstrap Grid Layout响应能力

关于html - 如何使我的菜单具有响应性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37702399/

相关文章:

html - 按钮不存在时呈现输入组

javascript - jQuery .prop() 未按预期工作

css - MDL点击 'mdl-navigation__link'时添加波纹效果

css - phpBB 论坛的背景停在屏幕底部而不是页面底部

javascript - Jquery treeview-如何通过单击按钮来展开/折叠给定的单个节点

html - polymer 网格布局中的最后一行

php - 提交 php.mysql 表单后出现访问被拒绝错误

html - 混淆 CSS 的宽度和高度

html - 事件类和悬停边框导致链接列表中的图像使用 Bootstrap 在 HTML 和 CSS 中跳过网格

javascript - 如何在 ng-click 之后动态添加类到父元素?