gpt4 book ai didi

html - 帮助处理 CSS 导航、文本定位和间距

转载 作者:行者123 更新时间:2023-11-28 18:56:47 26 4
gpt4 key购买 nike

全部,

http://rich2233.comoj.com/

我想做的三件事:

  1. 我需要将导航栏置于标题下方。这大概是一个简单的修复,但对于我的生活,我无法弄清楚。
  2. 我需要将导航中的文本垂直居中。
  3. 如何在左右两列之间放置一些空间?

感谢您的帮助!以下是 CSS 代码:

body,html {
margin:0;
padding:0;
color:#101010;
font-family: ‘Palatino Linotype’, ‘Book Antiqua’, Palatino, serif;


}

p {
margin-top: 30px;
font-size: 16px;
line-height: 1.3em;
padding-bottom: 10px;
text-align: center;
color: #ffffff;

}

p a{
text-decoration: none;
color: #4e6f8c;

}


#wrapper {
width:960px;
margin:0 auto;
padding: 0px;
background:#fff;
}

#header {
padding:5px 10px;
background:#fff;
height:137px;


}

#nav {
padding:5px 10px;
background:#fff;
width: 960px;
height: 40px;
font-size: 15px;
color: #7c7c7c;
text-align: center;


}

#nav ul {
margin:0;
padding:0;
list-style:none;
position: absolute;
bottom: 5px;
}

#nav li {
display:inline;
margin:0;
padding:0;
width:160px;
height: 45px;
float: left;
background-color: #f6f6f6;
-moz-border-radius: 25px 10px / 10px 25px;
border-radius: 25px 10px / 10px 25px;
}


#nav li:hover {
background-color: #df220f;

}

#nav li:hover a{
color: #ffffff;
text-decoration: none;

}

#nav a {

color: #fff;
text-decoration: none;
}


#nav a:link {
color: #7c7c7c;
text-decoration: none;


}

#nav a:visited{
color: #ffffff;
text-decoration: none;


}


#nav a:hover {
color: #ffffff;
text-decoration: none;



}

#nav a:focus {
color: #ffffff;
text-decoration: none;

}

#nav a:active {
color: #ffffff;
text-decoration: none;

}


#leftcontent {
float:left;
width:710px;
height: 300px;
background:#df220f;
-moz-border-radius: 1em 4em 1em 4em;
border-radius: 1em 4em 1em 4em;
background-image:url('./images/main_placeholder.png');
background-repeat:no-repeat;
background-position:center;
}

h2 {
margin:10px 0 0 20px;
color: #24389b;
font-size: 19px;
padding-bottom: 8px;
}

#rightcontent {
float:left;
width:250px;
background:#df220f;
height: 1%;
-moz-border-radius: 1em 4em 1em 4em;
border-radius: 1em 4em 1em 4em;
height: 300px;
background-image:url('./images/side_logo.png');
background-repeat:no-repeat;
background-position:bottom center;

}


#footer {
clear:both;
padding:5px 10px;
background:#fff;
}

#footer p {
margin:0;
}

* html #footer {
height:1px;
}

_______ HTML 编辑:

  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<link rel = "stylesheet" type = "text/css"
href = "./style.css" media = "all" />
</head>
<body>
<div id="wrapper">
<div id="header"><img src="./images/logo.png" alt="Ultrabond Logo" /></div>
<div id="nav">
<ul>
<li><a href="Research">Home</a></li>
<li><a href="Research">Service<br />Details</a></li>
<li><a href="Research">Service<br />Request</a></li>
<li><a href="Research">Crack<br />Repair</a></li>
<li><a href="Research">FAQs</a></li>
<li><a href="Research">Contact</a></li>
</ul>

</div>
<div id="leftcontent">

</div>
<div id="rightcontent">
<p>Average cost of a windshield<br />replacement: $240</p><p>Average <i>repair</i> cost: $60</p><p>Just another reason why<br />windshield <i>repair</i> makes sense</p>

</div>
<div id="footer">
</div>

</div>
</body>
</html>

最佳答案

首先你的链接失效了

1) 不要设置position: absolute对于 nav ul

2) 使用line-height规则 ( more detailed here )

3) 使用marginpadding .添加margin-left: <whatever you want>px#rightcontent

关于html - 帮助处理 CSS 导航、文本定位和间距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7591102/

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