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
Release: 2016-06-24 11:49:12
Original
1486 people have browsed it



   
      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{

Related labels:
source:php.cn
Previous article:How to use HTML's DELETE and PUT? _html/css_WEB-ITnose Next article:Why is the first active button I wrote not highlighted? _html/css_WEB-ITnose
Statement of this Website
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
Latest Articles by Author
Latest Issues
Related Topics
More>
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template