Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. float: right not working [modified]

float: right not working [modified]

Scheduled Pinned Locked Moved Web Development
csssysadmin
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    eggsovereasy
    wrote on last edited by
    #1

    <div style="width: 380px;">   <div style="float: right;">     <div style="height: 40px; vertical-align: middle;">       <asp:Button ID="btnTop" runat="server" Text="Top" CssClass="Button" Width="75px" />     </div>     <div style="height: 40px; vertical-align: middle;">       <asp:Button ID="btnUp" runat="server" Text="Up" CssClass="Button" Width="75px" />     </div>     <div style="height: 40px; vertical-align: middle;">       <asp:Button ID="btnDown" runat="server" Text="Down" CssClass="Button" Width="75px" />     </div>     <div style="height: 40px; vertical-align: middle;">       <asp:Button ID="btnBottom" runat="server" Text="Bottom" CssClass="Button" Width="75px" />     </div>   </div>   <asp:ListBox ID="lbItems" runat="server" Rows="10" Width="300px" Height="166px"></asp:ListBox> </div> I have the above code in an aspx page, but the div with float right appears above the listbox rather than to its right. If I remove the heights from the divs with buttons in them then the buttons appear to the right of hte list box, but they are all bunched together. I could easily acheive what I want here with a table, but I'm trying to make an all CSS page. Basically I want CSS for this table: <table>   <tr>     <td rowspan="4"></td>     <td></td>   </tr>   <tr>     <td></td>   </tr>   <tr>     <td></td>   </tr>   <tr>     <td></td>   </tr> </table> -- modified at 11:01 Tuesday 11th July, 2006

    G D 2 Replies Last reply
    0
    • E eggsovereasy

      <div style="width: 380px;">   <div style="float: right;">     <div style="height: 40px; vertical-align: middle;">       <asp:Button ID="btnTop" runat="server" Text="Top" CssClass="Button" Width="75px" />     </div>     <div style="height: 40px; vertical-align: middle;">       <asp:Button ID="btnUp" runat="server" Text="Up" CssClass="Button" Width="75px" />     </div>     <div style="height: 40px; vertical-align: middle;">       <asp:Button ID="btnDown" runat="server" Text="Down" CssClass="Button" Width="75px" />     </div>     <div style="height: 40px; vertical-align: middle;">       <asp:Button ID="btnBottom" runat="server" Text="Bottom" CssClass="Button" Width="75px" />     </div>   </div>   <asp:ListBox ID="lbItems" runat="server" Rows="10" Width="300px" Height="166px"></asp:ListBox> </div> I have the above code in an aspx page, but the div with float right appears above the listbox rather than to its right. If I remove the heights from the divs with buttons in them then the buttons appear to the right of hte list box, but they are all bunched together. I could easily acheive what I want here with a table, but I'm trying to make an all CSS page. Basically I want CSS for this table: <table>   <tr>     <td rowspan="4"></td>     <td></td>   </tr>   <tr>     <td></td>   </tr>   <tr>     <td></td>   </tr>   <tr>     <td></td>   </tr> </table> -- modified at 11:01 Tuesday 11th July, 2006

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      The select element (that the ListBox renders) is an inline tag, and the div element is a block tag. Put the ListBox in a div tag. The vertical-align style only works on table cells. --- b { font-weight: normal; }

      1 Reply Last reply
      0
      • E eggsovereasy

        <div style="width: 380px;">   <div style="float: right;">     <div style="height: 40px; vertical-align: middle;">       <asp:Button ID="btnTop" runat="server" Text="Top" CssClass="Button" Width="75px" />     </div>     <div style="height: 40px; vertical-align: middle;">       <asp:Button ID="btnUp" runat="server" Text="Up" CssClass="Button" Width="75px" />     </div>     <div style="height: 40px; vertical-align: middle;">       <asp:Button ID="btnDown" runat="server" Text="Down" CssClass="Button" Width="75px" />     </div>     <div style="height: 40px; vertical-align: middle;">       <asp:Button ID="btnBottom" runat="server" Text="Bottom" CssClass="Button" Width="75px" />     </div>   </div>   <asp:ListBox ID="lbItems" runat="server" Rows="10" Width="300px" Height="166px"></asp:ListBox> </div> I have the above code in an aspx page, but the div with float right appears above the listbox rather than to its right. If I remove the heights from the divs with buttons in them then the buttons appear to the right of hte list box, but they are all bunched together. I could easily acheive what I want here with a table, but I'm trying to make an all CSS page. Basically I want CSS for this table: <table>   <tr>     <td rowspan="4"></td>     <td></td>   </tr>   <tr>     <td></td>   </tr>   <tr>     <td></td>   </tr>   <tr>     <td></td>   </tr> </table> -- modified at 11:01 Tuesday 11th July, 2006

        D Offline
        D Offline
        dwatkins dirq net
        wrote on last edited by
        #3

        You shouldn't need to have a div around every button. That is extra markup and as you can see is actually using more markup than the table. Try something that will end up looking like this: CSS Float Test .btnlist {float:right;width:25%;background-color:#0FF;} .btnlist li {height:40px; list-style:none;}

        • list box item here

        • list box item here

        • list box item here

        • list box item here

        • list box item here

        -Dirk

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups