Improve company productivity with a Business Account.Sign Up

x
?
Solved

two divs floated right - but in wrong order

Posted on 2013-01-16
4
Medium Priority
?
595 Views
Last Modified: 2013-01-16
I have two divs that are floated right, but they are in the wrong order against the right edge of the parent div:

both float right
How can I ... "switch" them around?

I know the rules that govern floating are complex, so I appreciate any help you can give me.


Here is my current markup:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Preservation.ascx.cs"
    Inherits="Reo.ContentControls.Preservation" %>
<%@ Register Src="AssetFrameNavigation.ascx" TagName="AssetFrameNavigation" TagPrefix="uc2" %>
<%@ Register Assembly="Framework" Namespace="Framework.UIControls" TagPrefix="cc1" %>
<%@ Register TagPrefix="uc1" TagName="DateCalender" Src="~/Controls/DateCalendar.ascx" %>



<script type="text/javascript" src="../Scripts/jQueryDatePicker/jquery-ui-1.8.5.custom.min.js"></script>

<script type="text/javascript">


    $(document).ready(function () {

        $('div[id*="divserviceslabel"]').css('position', 'relative');
        $('div[id*="divserviceslabel"]').css('float', 'right');
    //    $('div[id*="divserviceslabel"]').css('clear', 'left');
        $('div[id*="divserviceslabel"]').css('font-size', '12px');
        $('div[id*="divserviceslabel"]').css('font-weight', 'bold');
        $('div[id*="divserviceslabel"]').css('color', '#7a3100');
        $('div[id*="divserviceslabel"]').css('margin-right', '200px');
        $('div[id*="divserviceslabel"]').css('border', 'thin green solid');

        $('div[id*="divservicestotal"]').css('position', 'relative');
        $('div[id*="divservicestotal"]').css('float', 'right');
        //$('div[id*="divservicestotal"]').css('clear', 'both');
        $('div[id*="divservicestotal"]').css('font-size', '12px');
        $('div[id*="divservicestotal"]').css('font-weight', 'bold');
        $('div[id*="divservicestotal"]').css('color', 'black');
      //  $('div[id*="divservicestotal"]').css('margin-right', '100px');
        $('div[id*="divservicestotal"]').css('border', 'thin brown solid');

       


       


        $('div[id*="divrepairlabel"]').css('position', 'relative');
        $('div[id*="divrepairlabel"]').css('float', 'right');
        $('div[id*="divrepairlabel"]').css('clear', 'both');
        $('div[id*="divrepairlabel"]').css('font-size', '12px');
        $('div[id*="divrepairlabel"]').css('font-weight', 'bold');
        $('div[id*="divrepairlabel"]').css('color', '#7a3100');
        $('div[id*="divrepairlabel"]').css('margin-right', '100px');
        $('div[id*="divrepairlabel"]').css('margin-top', '30px');
        $('div[id*="divrepairlabel"]').css('border', 'thin blue solid');


        $('div[id*="divrepairtotal"]').css('position', 'relative');
        $('div[id*="divrepairtotal"]').css('float', 'right');
        $('div[id*="divrepairtotal"]').css('clear', 'both');
        $('div[id*="divrepairtotal"]').css('font-size', '12px');
        $('div[id*="divrepairtotal"]').css('font-weight', 'bold');
        $('div[id*="divrepairtotal"]').css('color', 'black');
        $('div[id*="divrepairtotal"]').css('margin-right', '100px');
        $('div[id*="divrepairtotal"]').css('margin-top', '30px');
        $('div[id*="divrepairtotal"]').css('border', 'thin yellow solid');

    });

     

     		
    </script>


<div id="frame">
    <div id="frame_header">
        <uc2:AssetFrameNavigation ID="AssetFrameNavigation1" runat="server" />
        <!-- This is the frame main navigation tabs -->
        <div id="frame_title">
            <h1>
                Property Preservation</h1>
            <!-- Page tile -->
        </div>
        <div id="frame_header_secondary_Navigation" class="shown">
            <!-- This area is for the secondary navigation -->
            <!-- This is a sample navigation -->
            <!-- END of sample navigation -->
        </div>
    </div>
    <div id="corpus">
        <!-- This is where the content of each page should go -->
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <div class="frame_content_tab_area">
                    <div class="frame_content_tabs">
                        <ul id="tabList" runat="server">
                        </ul>
                    </div>
                    <table>
                        <tr>
                            <td>
                                <label>
                                    Property Preservation Services Vendor:</label>
                            </td>
                            <td>
                                <asp:Label ID="lblPropPresVendor" runat="server"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <label>
                                    Order Date:</label>
                            </td>
                            <td>
                                <asp:Label ID="lblPropPresOrderDt" runat="server"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <label>
                                    Cancel Date:</label>
                            </td>
                            <td>
                                <asp:Label ID="lblPropPresCancelDt" runat="server"></asp:Label>
                            </td>
                        </tr>
                    </table>
                    <h6>
                        Services</h6>
                    <div id="divServices" runat="server">
                        <cc1:GridviewFormatted ID="gvPreservation" runat="server" AllowSorting="False" AllowPaging="False"
                            PageSize="10" AutoGenerateColumns="false" DataSourceID="PreservationDataSource"
                            OnRowDataBound="gvPreservation_RowDataBound" CssClass="grid_view">
                            <Columns>
                                <asp:TemplateField HeaderText="Service" SortExpression="Preservation_Service">
                                    <ItemTemplate>
                                        <asp:HyperLink ID="lnkService" runat="server" Text='<%# Eval("Preservation_Service") %>'
                                            Target="_blank"></asp:HyperLink>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Bid Status" SortExpression="Preservation_Status">
                                    <ItemTemplate>
                                        <asp:Label ID="lblPreservation_Status" runat="server" Text='<%# Eval("Preservation_Status") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="OrderDt" SortExpression="OrderDt">
                                    <ItemTemplate>
                                        <asp:Label ID="lblOrderDt" runat="server" Text='<%# Eval("OrderDt","{0:d}") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="CompletedDt" SortExpression="CompletedDt">
                                    <ItemTemplate>
                                        <asp:Label ID="lblCompletedDt" runat="server" Text='<%# Eval("CompletedDt") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Provider" SortExpression="Provider">
                                    <ItemTemplate>
                                        <asp:Label ID="lblProvider" runat="server" Text='<%# Eval("Provider") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Bid Amount" SortExpression="BidAmt">
                                    <ItemTemplate>
                                        <asp:Label ID="lblBidAmt" runat="server" Text='<%# Eval("BidAmt") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </cc1:GridviewFormatted>                        
                        <div id="divserviceslabel" runat="server">Total Approved Preservation Bids:  </div><div id="divservicestotal" runat="server"></div>
                        <asp:LinqDataSource ID="PreservationDataSource" OnSelecting="PreservationDataSource_Selecting"
                            runat="server">
                        </asp:LinqDataSource>
                    </div>
                    <h6>
                        Utilities</h6>
                    <div id="divUtilities" runat="server">
                        <cc1:GridviewFormatted ID="gvUtilities" runat="server" AllowSorting="True" AllowPaging="False"
                            PageSize="10" AutoGenerateColumns="false" DataSourceID="UtilDataSource" OnRowDataBound="gvUtilities_RowDataBound"
                            CssClass="grid_view">
                            <Columns>
                                <asp:TemplateField HeaderText="Utilities" SortExpression="Utility">
                                    <ItemTemplate>
                                        <asp:HyperLink ID="lnkUtility" runat="server" Text='<%# Eval("Utility") %>' rel="shadowbox"></asp:HyperLink>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Transfer Date" SortExpression="TransferDt">
                                    <ItemTemplate>
                                        <asp:Label ID="lblTransferDt" runat="server" Text='<%# Eval("TransferDt") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Turned On" SortExpression="TurnedOn_Descript">
                                    <ItemTemplate>
                                        <asp:Label ID="lblTurnedOn_Descript" runat="server" Text='<%# Eval("TurnedOn_Descript") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Turned On Date" SortExpression="TurnedOnDt">
                                    <ItemTemplate>
                                        <asp:Label ID="lblTurnedOnDt" runat="server" Text='<%# Eval("TurnedOnDt") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Turned Off Date" SortExpression="TurnedOffDt">
                                    <ItemTemplate>
                                        <asp:Label ID="lblTurnedOffDt" runat="server" Text='<%# Eval("TurnedOffDt") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </cc1:GridviewFormatted>
                        <asp:LinqDataSource ID="UtilDataSource" OnSelecting="UtilDataSource_Selecting" runat="server">
                        </asp:LinqDataSource>
                    </div>
                    <h6>
                        Repairs</h6>
                    <div id="divFormList" runat="server">                   
                    </div>                    
                      <div id="divrepairlabel" runat="server">Total Approved Repair Bids:  </div><div id="divrepairtotal" runat="server"></div>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
        <asp:UpdateProgress ID="UpdateProgress1" runat="server">
            <ProgressTemplate>
                <div class="loading_image" id="loading_image" runat="server">
                    Please Wait...</div>
            </ProgressTemplate>
        </asp:UpdateProgress>         
    </div>
    <div id="footer">
    </div>
</div>
<div id="end_cap">
</div>

Open in new window

0
Comment
Question by:Tom Knowlton
4 Comments
 
LVL 30

Assisted Solution

by:LZ1
LZ1 earned 200 total points
ID: 38783680
Just switch them around in your markup. Simple, painless and quick.
0
 
LVL 25

Assisted Solution

by:Kyle Hamilton
Kyle Hamilton earned 200 total points
ID: 38783688
or throw them in a container, and float the container instead.
0
 
LVL 41

Accepted Solution

by:
guru_sami earned 1600 total points
ID: 38783739
Try this:
1: Add divs inside another div and float it right:

<div style="float:right;">
        <div id="divserviceslabel" runat="server">Total Approved Preservation Bids:</div>
        <div id="divservicestotal" runat="server">$600.00</div>
    </div>

Open in new window


2: and make the divs float left:
 $('div[id*="divserviceslabel"]').css('float', 'left');
 $('div[id*="divservicestotal"]').css('float', 'left');

Open in new window

0
 
LVL 5

Author Closing Comment

by:Tom Knowlton
ID: 38783757
All good solutions.  I went with guru sami's recommendation.
0

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

579 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question