简体   繁体   English

在div内添加新元素可将其他元素上下推

[英]Adding a new element inside div pushes other elements down and out

We are using a template we bought, I'm trying to shape a page but a div is being problematic. 我们正在使用我们购买的模板,我正在尝试对页面进行整形,但是div存在问题。

When I try to add new text boxes inside, other ones at the bottom gets pushed out. 当我尝试在其中添加新文本框时,底部的其他文本框将被推出。

This is my first time with bootstrap and I'm fairly new to css too. 这是我第一次使用Bootstrap,我对CSS也很陌生。 I dont know what is causing the problem. 我不知道是什么引起了问题。

This is the codepiece in middle of work. 这是工作的中间部分。 2 more textboxes to bottom and a combobox at the top will be added too. 底部还有2个文本框,顶部也将添加一个组合框。

<div class="register-container animated fadeInDown">
    <div class="registerbox bg-white">
        <div class="registerbox-title">Register</div>
        @Html.ValidationSummary("", new { @class = "text-danger" })

        <div class="registerbox-caption ">Lütfen Bilgilerinizi Giriniz</div>
        <div class="registerbox-textbox">
            @Html.Bootstrap().TextBoxFor(t => t.FirmaUnvani).Placeholder("Firma Ünvanı")
        </div>
        <div class="registerbox-textbox">
            @Html.Bootstrap().TextBoxFor(t => t.Sehir).Placeholder("Şehir")
        </div>
        <div class="registerbox-textbox">
            @Html.Bootstrap().TextBoxFor(t => t.Adres).Placeholder("Adres")
        </div>
        <div class="registerbox-textbox">
            @Html.Bootstrap().TextBoxFor(t => t.PostaKodu).Placeholder("Posta Kodu")
        </div>
        <div class="registerbox-textbox">
            @Html.Bootstrap().TextBoxFor(t => t.Email).Placeholder("Email Address")
        </div>
        <div class="registerbox-textbox">
            @Html.Bootstrap().TextBoxFor(t => t.Email).Placeholder("Email Address")
        </div>
        <div class="registerbox-textbox">
            @Html.Bootstrap().TextBoxFor(t => t.Email).Placeholder("Email Address")
        </div>
        <div class="registerbox-textbox">
            @Html.Bootstrap().PasswordFor(t => t.Password).Placeholder("Enter Password")
        </div>
        <div class="registerbox-textbox">
            @Html.Bootstrap().PasswordFor(t => t.ConfirmPassword).Placeholder("Confirm Password")
        </div>
        @*<hr class="wide" />*@
        <div class="registerbox-textbox">
            @Html.Bootstrap().TextBoxFor(t => t.Name).Placeholder("Name")
        </div>
        <div class="registerbox-textbox">
            @Html.Bootstrap().TextBoxFor(t => t.Family).Placeholder("Family")
        </div>
        <div style="padding-bottom:5px;padding-left:5px;background-color:white">
            <div class="checkbox">
                <label>
                    <input type="checkbox" class="colored-primary" checked="checked">
                    <span class="text darkgray"> <a class="themeprimary">Portal Kullanım Sözleşmesi</a>'ni okudum ve kabul ediyorum.</span>
                </label>
            </div>
        </div>
        <div class="registerbox-submit">
            @Html.Bootstrap().SubmitButton().Text("SUBMIT").Color(BootstrapColors.Primary).HtmlAttributes(new { @class = "pull-right" })
        </div>
    </div>
    <div class="logobox">
    </div>
</div>

and this is the original version of same page on template. 这是模板上同一页面的原始版本。

<div class="register-container animated fadeInDown">
        <div class="registerbox bg-white">
            <div class="registerbox-title">Register</div>
            @Html.ValidationSummary("", new { @class = "text-danger" })

            <div class="registerbox-caption ">Please fill in your information</div>
            <div class="registerbox-textbox">
                @Html.Bootstrap().TextBoxFor(t => t.Email).Placeholder("Email Address")
            </div>
            <div class="registerbox-textbox">
                @Html.Bootstrap().PasswordFor(t => t.Password).Placeholder("Enter Password")
            </div>
            <div class="registerbox-textbox">
                @Html.Bootstrap().PasswordFor(t => t.ConfirmPassword).Placeholder("Confirm Password")
            </div>
            <hr class="wide" />
            <div class="registerbox-textbox">
                @Html.Bootstrap().TextBoxFor(t => t.Name).Placeholder("Name")
            </div>
            <div class="registerbox-textbox">
                @Html.Bootstrap().TextBoxFor(t => t.Family).Placeholder("Family")
            </div>
            <div class="registerbox-textbox">
                <div class="row">
                    <div class="col-lg-6 col-sm-6 col-xs-6 padding-right-10">
                        @Html.Bootstrap().TextBoxFor(t => t.Month).Placeholder("Month")
                    </div>
                    <div class="col-lg-3 col-sm-3 col-xs-3 no-padding padding-right-10">
                        @Html.Bootstrap().TextBoxFor(t => t.Day).Placeholder("Day")
                    </div>
                    <div class="col-lg-3 col-sm-3 col-xs-3 no-padding-left">
                        @Html.Bootstrap().TextBoxFor(t => t.Year).Placeholder("Year")
                    </div>
                </div>
            </div>
            <div class="registerbox-textbox no-padding-bottom">
                <div class="checkbox">
                    <label>
                        <input type="checkbox" class="colored-primary" checked="checked">
                        <span class="text darkgray">I agree to the Company <a class="themeprimary">Terms of Service</a> and Privacy Policy</span>
                    </label>
                </div>
            </div>
            <div class="registerbox-submit">
                @Html.Bootstrap().SubmitButton().Text("SUBMIT").Color(BootstrapColors.Primary).HtmlAttributes(new { @class = "pull-right" })
            </div>
        </div>
        <div class="logobox">
        </div>
    </div>

Broken version, submit is so badly pushed down that there is 1 or 2 pixels between it and the end of page. 版本太差,提交被严重下推,以至页面末尾只有1或2个像素。 And I dont know why page is not resizing itself too. 而且我不知道为什么页面本身也没有调整大小。 版本损坏,请查看登录按钮被按下的严重程度

template original version for getting a sense 模板原始版本,让您有一个感觉 模板原始版本,让您有一个感觉

My main problem is, being new to this I don't know where to look at or change what. 我的主要问题是,对此不熟悉,我不知道在哪里看或更改什么。 Also, "register-container" is present at two css sheets. 另外,“ css容器”出现在两个css页面上。 Both a one long line... 都长一排...

edit: 编辑:

As I said those css sheets are a mess, a real mess. 正如我说的那样,这些CSS工作表是一团糟,真正的混乱。 I'm pasting everything related to registerbox and register-containers now. 我现在粘贴与寄存器箱和寄存器容器相关的所有内容。

Results having Registerbox in beyond-rtl.min.css -rtl.min.css中具有Registerbox的结果

.register-container.registerbox{
    position:relative;
    width:350px !important;
    height:560px !important;
    padding:0;
    -webkit-box-shadow:0 0 14px rgba(0,0,0,.1);
    -moz-box-shadow:0 0 14px rgba(0,0,0,.1);
    box-shadow:0 0 14px rgba(0,0,0,.1)
}
.register-container .registerbox .registerbox-title{
    position:relative;
    text-align:right;
    width:100%;
    height:35px;
    padding:20px 20px 0;
    font-family:'Lucida Sans','trebuchet MS',Arial,Helvetica;
    font-size:18px;
    text-transform:uppercase;
    font-weight:normal;
    color:#444
}
.register-container .registerbox .registerbox-caption{
    font-size:14px;
    font-weight:500;
    color:#a9a9a9;
    padding:15px 20px 0
}
.register-container .registerbox .registerbox-textbox{
    padding:10px 20px
}
.register-container .registerbox .registerbox-textbox .form-control{
    -webkit-border-radius:3px !important;
    -webkit-background-clip:padding-box !important;
    -moz-border-radius:3px !important;
    -moz-background-clip:padding !important;
    border-radius:3px !important;
    background-clip:padding-box !important
}
.register-container .registerbox .registerbox-submit{
    padding:0 20px
}

Results having registerbox in beyond-min.css 结果在超出min.css中具有寄存器

.registerbox{
    position:relative;
    width:350px !important;
    height:560px !important;
    padding:0;
    -webkit-box-shadow:0 0 14px rgba(0,0,0,.1);
    -moz-box-shadow:0 0 14px rgba(0,0,0,.1);
    box-shadow:0 0 14px rgba(0,0,0,.1)
}
.register-container .registerbox .registerbox-title{
    position:relative;
    text-align:left;
    width:100%;
    height:35px;
    padding:20px 20px 0;
    font-family:'Lucida Sans','trebuchet MS',Arial,Helvetica;
    font-size:18px;
    text-transform:uppercase;
    font-weight:normal;
    color:#444
}
.register-container .registerbox .registerbox-caption{
    font-size:14px;
    font-weight:500;
    color:#a9a9a9;
    padding:15px 20px 0
}
.register-container .registerbox .registerbox-textbox{
    padding:10px 20px
}
.register-container .registerbox .registerbox-textbox .form-control{
    -webkit-border-radius:3px !important;
    -webkit-background-clip:padding-box !important;
    -moz-border-radius:3px !important;
    -moz-background-clip:padding !important;
    border-radius:3px !important;
    background-clip:padding-box !important
}
.register-container .registerbox .registerbox-submit{
    padding:0 20px
}

register-container in beyond-rtl.min.css beyond-rtl.min.css中的注册容器

register-container{
    position:relative;
    margin:8% auto;
    max-width:350px
}

registerbox is where your problem is at, you need to increase the height property. 收件箱就是您要解决的问题,您需要增加height属性。 I would first put the style directly on the div right after the class="" property to test to make sure that increasing it will work. 我首先将样式直接放在class =“”属性之后的div上进行测试,以确保增加样式可以正常工作。 This way you won't have to mess with the css just yet. 这样,您就不必麻烦CSS了。

Once you figure out how much to increase the height, the you can modify the CSS file with the proper value. 确定增加高度后,您可以使用适当的值修改CSS文件。

Gravedigging a bit here, but unminified your code to make it a bit easier to read, and every height property I see has a static value (ie 350px) which is the problem. 在这里进行了一些深入的研究,但未精简代码以使其更易于阅读,并且我看到的每个height属性都有一个静态值(即350px),这就是问题所在。 You'll need to change these heights in your containers to allow for more content or allow the browser to automatically choose its height. 您需要更改容器中的这些高度,以允许更多内容或允许浏览器自动选择其高度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM