gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 01:11:11 25 4
gpt4 key购买 nike

我在这里创建了一个弹出菜单: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/

25 4 0