How to get Floating DIVs inside fixed-width DIV to continue horizontally?

前端 未结 9 494
情歌与酒
情歌与酒 2020-12-02 12:43

I have a container DIV with a fixed height and width (275x1000px). In this DIV I want to put multiple floating DIVs each with a width of 300px, and have a horizontal (x-axi

相关标签:
9条回答
  • 2020-12-02 13:09

    Use:

        div#container {
            overflow: auto;
        }
    

    Or add a clearing div below the three divs with the style:

        {
            clear: both
        }
    
    0 讨论(0)
  • 2020-12-02 13:14

    It sounds like you are doing gallery with div's?

    What exactly are you using the divs for?

    It may be easier to use a ul/li with spans inside of the li to get the same effect without all the headaches of floating divs.

    0 讨论(0)
  • 2020-12-02 13:15

    My Ex:

    div width: 850px gridview templatedcolumn ItemTemplate

    <span class="buttonspanlt"></span><asp:Button ID="imgEditSave" runat="server" Text="Edit SubStatus" CssClass="buttoncenter" OnClick="imgEditSave_OnClick"/><span class="buttonspanrt"></span>
    <span style="display:none;float:left;clear:left;" id="spangrdCancel" runat="server"><span class="buttonspanlt"></span><asp:Button ID="imgCancel" runat="server" Text="Cancel" class="buttoncenter"/><span class="buttonspanrt"></span></span>
    

    end ItemTemplate end templatedcolumn end gridview end div

    the button has left middle(actual button) right spans which where not floating as there was outer div with fixed width.

    I had to use additional div with width 140px outside the button , inside the itemtemplate then it worked.

    Hope this helps!!!

    Thank You Harish

    0 讨论(0)
提交回复
热议问题