gpt4 book ai didi

html - 卡在尝试对齐 Logo 旁边的菜单项

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

我无法让我的菜单项在我的导航栏中与我的 Logo 对齐。我的菜单项出现在我的 Logo 下方和右侧,水平位置正确,我需要向上调整垂直位置,以便元素在导航栏内排成一行。

HTML

<!DOCTYPE html>
<html>
<head>
<title>Serving Grace - Home</title>
<!-- Stylesheet -->
<link href="Private/stylesheet.css" rel="stylesheet" type="text/css"/>
</head>

<body>
<div id="content">
<nav id="nav">
<ul>
<li><a href="index.html" id="logo"><img src="Logo/logo.png"/></a></li>
<li><a href="index.html">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Volunteer</a></li>
<li><a href="#">Donate</a></li>
<ul>
</nav>

<div id="image">
<img src="Images/Content.png"/>
</div>

<div id="info">
<img src="Images/info.png"/>
</div>

<div id="footer">
<a href="www.facebook.com"><img src="Images/Facebook.fw.png"></a>
<a href="www.twitter.com"><img src="Images/Twitter.fw.png"></a>
<a href="www.google.com"><img src="Images/Google.fw.png"></a>

<p id="copyright">&#169; 2013 Jeffery Evans</p>
</div>

</div>
</body>

</html>

CSS

body {
background-color: #C8C8C8;
}

#content {
width: 1090px;
height: 900px;
background-color: white;
margin-left: auto;
margin-right: auto;
box-shadow: 5px 3px 5px #888;
min-height: 100%;
position: relative;
}

#nav {
background-color: #222222;
height: 100px;
border: 1px solid black;
}

#nav li {
text-decoration: none;
display: inline;
margin: 25px 20px 10px 10px;
font-family: Arial;
color: #F59239;
position: relative;
}

#nav li a {
text-decoration: none;
color: #F59239;
font-family: Arial;
font-size: 18px;
}

#logo {
padding-right: 300px;
position: inline-block;
}

#nav li a:hover {
color: #222222;
}

#image {
top: 100px;
position: relative;
float: left;
left: 15px;
}

#info {
top: 100px;
position: relative;
float: left;
left: 30px;
}

#footer {
display: table-cell;
width: 1090px;
height: 70px;
background-color: #222222;
bottom: 0;
position: absolute;
}

#footer a {
margin-left: 15px;
}

#copyright {
color: white;
text-align: center;
vertical-align: middle;
}

最佳答案

代替

#nav {
height: 100px;
}

尝试类似的东西

#nav {
line-height: 100px;
}

如果这不起作用,那么也可以尝试为您的导航栏和/或导航栏使用行高

最简单的方法就是做这样的事情

#logo {
padding-top: 10px;
}

这只会将 Logo 向下推 10px,相应地进行调整

关于html - 卡在尝试对齐 Logo 旁边的菜单项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20590145/

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