gpt4 book ai didi

html - 响应式导航问题

转载 作者:太空宇宙 更新时间:2023-11-03 17:58:55 26 4
gpt4 key购买 nike

我正在处理我的作品集,但我的 Logo 和导航有问题。

这就是我想要的:http://i.imgur.com/Xj0ROHp.jpg

我想让它在 3 个不同的断点处像那样显示,但目前我遇到的是导航会直接进入 Logo ,而不会像我希望的那样掉到它下面。我之前让它正常工作,但我不确定出了什么问题。任何建议都会很棒!

HTML:

<!DOCTYPE html>
<html>
<head>

<title>Portfolio</title>
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/lightbox.min.js"></script>
</script>
<link href="css/lightbox.css" rel="stylesheet" />

<link href="style.css" type="text/css" rel="stylesheet" />


</style>


</head>
<body>
<div id="wrapper">
<div id="header">
<div id="logo">
<h1><a href="">NAME</a></h1>
</div>
<div id="nav">

<ul>
<li><a href="">HOME</a></li>
<li><a href="">ABOUT</a></li>
<li><a href="">CONTACT</a></li>
</ul>
</div>
</div>

<div id="content">

<div class="article column1">
<a href="new.mp4" rel="shadowbox;height=338;width=600" title="LOGO ANIMATION"> <img class="hoverme" src="images/animation1.jpg"></a>
</div>
<div class="article column2">
<a href="images/northforest.jpg" data-lightbox="image-1" data-title="Logo Design"> <img class="hoverme" src="images/nfsmall.jpg"></a>
</div>
<div class="article column3">
<a href="images/flyer.jpg" data-lightbox="image-1" data-title="Flyer"> <img class="hoverme" src="images/flyersmall.jpg"></a>
</div>
<div class="article column4">
<a href="images/menu.jpg" data-lightbox="image-1" data-title="Flyer"> <img class="hoverme" src="images/menusmall.jpg"></a>
</div>
<div class="article column5">
<a href="images/article.jpg" data-lightbox="image-1" data-title="Article"> <img class="hoverme" src="images/articlesmall.jpg"></a>
</div>
<div class="article column6">
<a href="ahlogo.mp4" rel="shadowbox;height=338;width=600" title="LOGO ANIMATION"> <img class="hoverme" src="images/animation2.jpg"></a>
</div>
</div>
<div id="footer">

</div>

</div>

<link rel="stylesheet" type="text/css" href="shadowbox.css">
<script type="text/javascript" src="shadowbox.js"></script>
<script type="text/javascript">
Shadowbox.init({
handleOversize: "resize"
});
</script>
</body>
</html>

CSS:

    @font-face { 
font-family: 'bikoblack';
src: url('fonts/biko_black.otf');
}

@font-face {
font-family: 'bikoregular';
src: url('fonts/biko_regular.otf');
}

.hoverme {

border: 3px solid #d0d0d0;

}

.hoverme:hover {
opacity: .5;
-webkit-transition: all .9s ease-in-out;
-webkit-transition: all .4s ease-in-out;
-moz-transition: all .4s ease-in-out;
}

a:link {
color: #0f4c96;
}
a:visited {
color: #0f4c96;
}
a:hover {
color: #b2b1b1;
}
a:active {
color: #0f4c96;
}

* {
text-align: center;
}
body {

margin: 0;
font-size: 100%;
background-color: white;
}
#wrapper {
max-width:90%;
margin:0 auto;

}


img {width: 100%; height: 100%;
}


h1 {
font-family: 'bikoblack';
text-transform: uppercase;
font-size: 3.5em;
line-height: 85%;
color: #0f4c96;
float: left;


}
#header {
position:relative;
overflow:hidden;
}


#nav {

position:absolute;
bottom:1.25em;
right:1em;
}
li {
display: inline;
font-family: 'bikoregular';
color: #0f4c96;
padding-left: 2em;
}


.column1, .column2, .column3, .column4, .column5, .column6 {
width: 32.66%;
height: 15em;
float: left;
margin: 1% 1% .01% 0%;

}
.column3, .column6 {
margin-right: 0%;}
}


@media (max-width:767px) {
h1 {
float: none;
width:100%;
text-align:center;
}
#nav {
position:static;
width:100%;margin:0 auto;
top: 5em;
}
li {
width:100px;
padding: 0 1em;
}
}




@media (max-width:480px){
li {
display:block;
text-align:center;
width:auto;
}

}


a {text-decoration: none; }

最佳答案

你需要做一些小的改变,你的 CSS 也有一些错误,包括未关闭的属性和错误的媒体查询。试试这个:

.hoverme {
border: 3px solid #d0d0d0;
}
.hoverme:hover {
opacity: .5;
-webkit-transition: all .9s ease-in-out;
-webkit-transition: all .4s ease-in-out;
-moz-transition: all .4s ease-in-out;
}
a:link {
color: #0f4c96;
}
a:visited {
color: #0f4c96;
}
a:hover {
color: #b2b1b1;
}
a:active {
color: #0f4c96;
}
* {
text-align: center;
}
body {
margin: 0;
font-size: 100%;
background-color: white;
}
#wrapper {
max-width:90%;
margin:0 auto;
}
img {
width: 100%;
height: 100%;
}
#header {
position:relative;
overflow:hidden;
display:block;
}
h1 {
font-family:'bikoblack';
text-transform: uppercase;
font-size: 3.5em;
line-height: 85%;
color: #0f4c96;
display:block;
width:35%;
float:left;
}
#nav {
display:block;
width:50%;
float:right;
margin-top:1.85em;
}
li {
display: inline-block;
font-family:'bikoregular';
color: #0f4c96;
padding: 0 1em;
}
.column1, .column2, .column3, .column4, .column5, .column6 {
width: 32.66%;
height: 15em;
float: left;
margin: 1% 1% .01% 0%;
}
.column3, .column6 {
margin-right: 0%;
}
@media all and (max-width: 767px) {
h1 {
float: none;
clear:both;
display:block;
width:100%;
text-align:center;
}
#nav {
position:relative;
display:block;
width:100%;
margin:0 auto;
top: 0em;
float:none;
clear:both;
text-align:center;
}
li {
width:100px;
padding: 0 1em;
}
}
@media all and (max-width: 480px) {
li {
display:block;
text-align:center;
width:auto;
}
}
a {
text-decoration: none;
}

当然,您必须根据自己的需要进行调整,但是您已经有了所需布局的基础知识,您可以 see a fiddle here这样你就可以玩了。另外,一定要注意你的 CSS 编写方式,这是你的版本不起作用的主要原因

关于html - 响应式导航问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25777077/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com