javascript - div 内的元素未居中对齐

标签 javascript html css

如何让div里面的容器居中对齐.... 我给了 margin left 和 right auto 但它不起作用.... 在 iphone 布局中,它变为居中对齐 在下面提供我的代码....

http://jsfiddle.net/2a5mW/1/embedded/result/

<div class="hide fade in" id="signup-modal" conduit_fixed_handled="true" conduit_orig_mtop_val="-306" style=" display: block;" aria-hidden="false">
    <div class="page-title">Add New Vendor</div>
    <div>
                    <span>Vendor no</span>


100012                  <span style="">Starting no:</span><span style="color: red;">100000</span>
                </div>

    <h4 class="billingAddress">Billing Address</h4>

    <form method="POST" autocomplete="off" id="auth-form">
        <input type="hidden" name="usertype" value="3" readonly="">
        <fieldset>      
            <input type="text" placeholder="Company Name " name="fullname" maxlength="30" required="required" id="id_username">
            <input type="text" placeholder="Contact Name" name="company" maxlength="30" required="required" id="id_company">        
            <input type="text" placeholder="Address1" name="email" maxlength="75" required="required" id="id_email">
            <input type="password" placeholder="Address2" name="password" maxlength="16" required="required" id="id_password">
            <input type="password" placeholder="Address3" name="repassword" required="required" id="id_repassword">
            <input type="text" placeholder="City " name="fullname" maxlength="30" required="required" id="id_username">
            <div class="controls"

最佳答案

#signup-modal, #login-modal {
width: 300px;
background: none repeat scroll 0% 0% rgb(255, 255, 255);
border-radius: 10px 10px 10px 10px;
overflow: hidden;
margin-bottom: 40px;
box-shadow: 0px 1px 0px white inset;
padding: 0px 40px;
margin-left: auto;
margin-right: auto;
}

这适用于 Firefox 和 Chrome。

关于javascript - div 内的元素未居中对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15643641/

相关文章:

javascript - 灯箱不起作用,尽管加载了 jquery

javascript - css3 animation-delay 只适用于 Firefox?

javascript - 从与选定复选框相邻的文本框中获取选定文本

html - ASP.NET MVC - 浏览器不断记住不同模型的输入

javascript - 基本的 Javascript 和 html 对象执行

asp.net - 如何将 CssClass 应用于 DataGrid HyperLinkColumn 的标题单元格?

css - 三 Angular 形边框图像渐变图案

javascript - 在 Safari 扩展中使用 jQuery

javascript - 处理 bool 值

javascript - Django 表单上的 TinyMCE