初学css+div问题,float定位问题

来源:互联网 发布:怎么做淘宝模特 编辑:程序博客网 时间:2024/05/22 06:23

初学css+div问题,float定位问题,不太会描述,先代码。
用的是母版,下面这个是首页。

[code=HTML]<%@ Page Title="" Language="C#" MasterPageFile="~/SiteFront.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="BanJiWebsite.Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
  <style type="text/css">
  .clearfloat {clear:both;height:0;font-size: 1px;line-height: 0px;}
  </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

<div  style=" float:left; margin-left:20px;  margin-top:20px;  border:2px groove #77b7cc; width:300px; height:300px; background-color:Gray;">这里是幻灯片 待做。
 
    </div>
   <div style="width:300px;height:300px; float:right; margin-top:20px; margin-right:100px; border:2px solid gray; text-align:left; ">
     <div style="background-color:Gray; font-size:20px">班级通知&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="font-size:15px" href="NewsList.aspx" >更多...</a></div>
        <asp:Repeater ID="Repeater1" runat="server" DataSourceID="odsNews">
        <HeaderTemplate><ul style=" list-style:none;"></HeaderTemplate>
        <ItemTemplate><li ><a href='ViewNews.aspx?id=<%#Eval("ID") %>'><%#Eval("Title")%>[<%#Eval("CreateDate", "{0:MM-dd}")%>]</li></ItemTemplate>
        <FooterTemplate></ul></FooterTemplate>
        </asp:Repeater></div>
   
       <br class="clearfloat" /><!-- 用于清除浮动的元素 -->
      
    
<div style=" height:60px; background-color:#77b7cc"></div>

      
<asp:ObjectDataSource ID="odsNews" runat="server"
        OldValuesParameterFormatString="original_{0}" SelectMethod="GetLstNewsData"
        TypeName="BanJiWebsite.DAL.DataSetNewsTableAdapters.T_NewsTableAdapter">
    </asp:ObjectDataSource>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="<%$ ConnectionStrings:BJDBConnectionString %>"
        SelectCommand="SELECT TOP (10) ID, FileTitle, CreateTime FROM T_DataBank ORDER BY CreateTime DESC">
    </asp:SqlDataSource>
 
    </asp:Content>
[/code]


然后就出现了下面这种情况,纠结,求各位指点下!谢了!