gpt4 book ai didi

html - CSS 获取文章中心

转载 作者:太空宇宙 更新时间:2023-11-03 19:46:00 25 4
gpt4 key购买 nike

我的目标是把文章放在leftnav和rightnav中间。我当前的语法允许 leftnav 和 aside 相互“粉碎”。我在我的文章中添加了 margin-left 和 padding left,但似乎不起作用。我如何才能在不“粉碎”到左侧导航的情况下将文章放在页面中央?谢谢大家。

CSS

/* CSS Document */

body{
background-color:#9F6;
}

section{
width:960px;
/*padding:15px;*/
}

header{
height:150px;
outline:#000 dotted;
}

nav{
position:relative;
outline:#000 dotted;
}

nav ul{
padding:15px;
}

nav ul li{
/* Moves the nav in a horizontal fashion */
display:inline;
}

nav ul li a{
list-style-type:none;
text-decoration:none;
text-transform:capitalize;
padding:15px;
}

nav ul li a:hover{
background-color:#F00;
color:#0FF;
}

#leftnav{
float:left;
width:160px;
outline:#000 dotted:
/*margin-right:15px; */
/*padding:15px;*/
/*padding-right:2cm;*/
}

#rightnav{
float:right;
width:160px;
outline:#000 dotted:
}

aside, article{
min-height: 550px;
/*background-color: #F96;*/
outline:#000 dotted;
/*padding: 1px;*/
}

article{
width:750px;
/*margin-left:15px;*/
/*padding-left:65px;*/
}

footer{
width:960px;
outline:#000 dotted;
margin-top:15px;
text-align:center;
}

HTML

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="another-css.css">
<title>Another Test</title>
</head>

<body>
<section>
<header>
<h3>This Is The Header</h3>
</header>

<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Cars</a></li>
<li><a href="#">About Us</a></li>
<li><a href="#">Contact us</a></li>
</ul>
</nav>

<aside id="leftnav">
aside left
</aside>

<aside id="rightnav">
aside right
</aside>

<article>
article
</article>

<footer>
Copyright 2013
</footer>

</section>
</body>

</html>

最佳答案

margin-left: auto;
margin-right: auto;

你试过在文章上使用上面的代码吗

关于html - CSS 获取文章中心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19336849/

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