Shimmy Weitzhandler
Shimmy Weitzhandler

Reputation: 104741

Problem with HTML DIV style-padding

<asp:UpdatePanel runat="server">
    <ContentTemplate>
        <div style="padding: 0px 45px 0px 45px">
            <asp:FormView ID="fvAccounts" runat="server" DataKeyNames="AccountId" DataSourceID="edsAccounts" EnableModelValidation="True" Width="100%">
                <EditItemTemplate>
<%-- continuing --%>

I want the FormView to be 45px (hippos :P) away from the page's width, so I wrapped it with a div setting its padding to 45 for right and left, but it didn't work; the right side goes out the div. I want it to be minimized within the div.

Note the black line in the image, it shows where the edge of the parent is, I want the external right side to be 45px away from it to inside. example

Upvotes: 0

Views: 7546

Answers (4)

Shimmy Weitzhandler
Shimmy Weitzhandler

Reputation: 104741

Well I solved my issue in quite a different way.

I set the FormView's Width to 80% and I wrapped it with a center Html tag.

<center>
    <FormView Width="80%" runat="server" />
</center>

Upvotes: 0

Emily
Emily

Reputation: 10088

You must have a width set on some element inside the <div style="padding:0 45px">. Reduce the width by 90px because that space is now taken up by the padding.

Upvotes: 0

Alsciende
Alsciende

Reputation: 26971

Remove the div and give a "0px 45px" margin to the FormView.

Upvotes: 0

Quentin
Quentin

Reputation: 943564

The CSS validator is your friend.

http://jigsaw.w3.org/css-validator/validator?text=a{padding%3A45%3B}&profile=css21&usermedium=all&type=none&warning=1&lang=en

45 what? Hippos? For lengths (other than 0) units are required.

padding: 45mm;
padding: 45%;
padding: 45pt;
padding: 45px;

and so on.

Upvotes: 3

Related Questions