locked
How to left align a card div RRS feed

  • Question

  • User881762781 posted

    I am trying to align a card div element to the left side of my web form as by default it is sitting slightly off centre.

    I have tried various methods to get this to work however I have only been able to centre it successfully and not get it to dock at the left side of the page.

    Can anyone assist?

    <div class="card text-white bg-primary mb-3" style="max-width70remfloatleft;">
        <div class="card-header"><h4>Add User</h4></div>
        <div class="card-body">
            
                <div class="row">
                    <div class="col-md-5">
                        <asp:Label id="lblUsername" Text="Username" runat="server"/>
                    </div>
                    <div class="col-md-5">
                        <asp:Label id="lblFirstName" Text="First Name" runat="server"/>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-5">
                        <asp:TextBox id="tbUsername" class="form-control" placeholder="" runat="server" ValidationGroup="AddUserVG"/>
                        <asp:RequiredFieldValidator id="rfvUsername" class="text-danger" runat="server" ControlToValidate ="tbUsername" ValidationGroup="AddUserVG"
                            ErrorMessage="Please enter username" Display="Dynamic"></asp:RequiredFieldValidator>
                    </div>
                    <div class="col-md-5">
                        <asp:TextBox id="tbFirstName" class="form-control" placeholder="" runat="server" ValidationGroup="AddUserVG"/>
                        <asp:RequiredFieldValidator id="rfvFirstName" class="text-danger" runat="server" ControlToValidate ="tbFirstName" ValidationGroup="AddUserVG"
                            ErrorMessage="Please enter first name" Display="Dynamic"></asp:RequiredFieldValidator>
                    </div>
                </div>
     
                <asp:Button ID="btnSave" Text="Save" CssClass="btn btn-primary" style="floatright" OnClick="btnSave_OnClick" runat="server" ValidationGroup="AddUserVG"/>
        </div>
    </div>
    Thursday, March 4, 2021 9:00 AM

All replies

  • User1535942433 posted

    Hi MattNorman,

    According to your description and codes, I couldn't reproduce your issue. You only post the card.

    Please post codes about out of the card in the page.

    Best regards,

    Yijing Sun

    Friday, March 5, 2021 2:23 AM
  • User-857013053 posted

    According to your code, it aligns a card div element to the left side of your web form.
    There is no issue in this code you posted for the card but there is an issue above the card.
    Please post codes about out of the card on the page.

    Wednesday, March 10, 2021 4:39 AM