日期:2014-05-17  浏览次数:20782 次

CSS分栏问题
css如下:
.main {width: 966px; margin: 40px auto;}
.main_picture {}
.now {}
.home_passage {position: relative; background-color: #FFFFFF;}
.3_1 {width: 321px; border-right: 1px solid #3c3c3c; background-color:#FFFFFF; float: left;}
.3_2 {width: 321px; border-right: 1px solid #3c3c3c; background-color:#FFFFFF; float: left;}
.3_3 {width: 322px; background-color:#FFFFFF; float: left;}
.space {clear: both;}
.footer {position: relative;}

html如下
<body>
<div class="main">
  <div>jksdjflsdjflkdsjl</div>
  </div>
  <div class="main_picture">
  lksdjflkjsldfjlasdjfljsadf
  </div>
  <div class="now">
  lksadjfljs
  </div>
  <div>
  klsdjflasjdf
  </div>
  <div class="home_passage">
  <div class="3_1">
  jkldsjflsdjflsd
  </div>
  <div class="3_2">
  sdfsdlfkjsdkjf
  </div>
  <div class="3_3">jsldfjldsjflsdf
  </div>
  </div>
  <div class="space">
  </div>
  <div class="footer">
  jlsdfjlsdjflsd
  </div>
</body>
显示时总是不分栏,怎么回事?

------解决方案--------------------
起名字最好起一些稳妥一点的
HTML code
<style>
.main {width: 966px; margin: 40px auto;}
.main_picture {}
.now {}
.home_passage {position: relative; background-color: #FFFFFF;}
.h3_1 {width: 321px; border-right: 1px solid #3c3c3c; background-color:#FFFFFF; float: left;}
.h3_2 {width: 321px; border-right: 1px solid #3c3c3c; background-color:#FFFFFF; float: left;}
.h3_3 {width: 322px; background-color:#FFFFFF; float: left;}
.space {clear: both;}
.footer {position: relative;}
</style>

<body>
<div class="main">
  <div>jksdjflsdjflkdsjl</div>
  </div>
  <div class="main_picture">
  lksdjflkjsldfjlasdjfljsadf
  </div>
  <div class="now">
  lksadjfljs
  </div>
  <div>
  klsdjflasjdf
  </div>
  <div class="home_passage">
  <div class="h3_1">
  jkldsjflsdjflsd
  </div>
  <div class="h3_2">
  sdfsdlfkjsdkjf
  </div>
  <div class="h3_3">jsldfjldsjflsdf
  </div>
  </div>
  <div class="space">
  </div>
  <div class="footer">
  jlsdfjlsdjflsd
  </div>
</body>