Home >Web Front-end >HTML Tutorial >Why are left and right still centered? _html/css_WEB-ITnose

Why are left and right still centered? _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:49:121488browse



   
      left


      right

   
   




body{
height:100%;
width:100%;
border:none;
font:Arial, Helvetica, sans-serif;
font-size:12px;
color:black;
background-color:#FFF;
margin:0;
padding:0;
text-align:center;
}
.mass{
width:951px;
}
.border{
border:#906 solid 1px;
}
#nav{
width:auto;
}
#nav.left{
float: left;
width: 371px;
}
#nav.right{
float: right;
width: 580px;
}


回复讨论(解决方案)

body 去掉text-align:center

但是我想实现 在同一行left在左,right在右的情况。我参考一个教程上的,但是不行

不是float. 
可以用text-align:left/right/center 来实现.

还是不行啊....

#nav和.left之间要要空格
#nav .left{
#nav .right{

#nav和.left之间要有空格
#nav .left{
#nav .right{

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to use HTML's DELETE and PUT? _html/css_WEB-ITnoseNext article:How to use HTML's DELETE and PUT? _html/css_WEB-ITnose

Related articles

See more