简体   繁体   English

如何修复内容未显示的框?

[英]How to fix box around content not showing?

I'm trying to wrap multiple things within a box, namely a login feature. 我试图在一个盒子里包装多个东西,即登录功能。 However when I've tried putting the content within it's own but even after editing the css the actual changes don't show 但是,当我尝试将内容放在自己的内容中时,即使在编辑css之后,实际的更改也没有显示出来

I've tried both a .boxed method and a .box + .white (for background) method. 我已经尝试过.boxed方法和.box + .white(用于后台)方法。 Neither show any differences 两者都没有显示任何差异

<div class="form-horizontal">
        <div class="box white">
            <h4>tbl_Gebruiker</h4>
            <hr />
            @Html.ValidationSummary(true, "", new { @class = "text-danger" })

            <div class="form-group">
                @Html.LabelFor(model => model.gebruikersnaam, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.EditorFor(model => model.gebruikersnaam, new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.gebruikersnaam, "", new { @class = "text-danger" })
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.wachtwoord, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.EditorFor(model => model.wachtwoord, new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.wachtwoord, "", new { @class = "text-danger" })
                </div>
            </div>

            <div class="form-group">
                <div class="col-md-offset-2 col-md-10">
                    <input type="submit" value="Create" class="btn btn-default" />
                </div>
            </div>
        </div>
    </div>

And for the css: 而对于CSS:

.box {
      width: 800px;
      height: 500px;
      border: 2px black;
  }
  .white {
      background: white;
  }

What I expect to happen is that the login feature gets wrapped in a white box with a black border. 我期望发生的是登录功能被包裹在带有黑色边框的白色框中。 What happens is well, nothing. 什么事情都很好,没有。

The reason why you are not able to see the border even after applying the .box class is that you haven't declared the border-style . 即使在应用.box类之后您仍无法看到边框的.box是您尚未声明边框样式 So, a default value of none is taken which specifies no border. 因此,默认值为none ,指定无边框。

As per the Border property syntax it accepts one or more of the following values in combination: 根据Border属性语法,它接受以下一个或多个值的组合:

border:  <border-width> || <border-style> || <color>

And what you have specified is a border-width and color without the border-style for the border property which makes the .box class border property as: border:2px black none . 你指定的是border-widthcolor没有border属性的border-style ,这使得.box类的border属性为: border:2px black none

So, change the class .box from this: 所以,从这个改变类.box

.box {
  width: 800px;
  height: 500px;
  border: 2px black;
}

To this: 对此:

.box {
  width: 800px;
  height: 500px;
  border: 2px solid black;
}

And you will be able to see the border. 你将能够看到边界。

If i am getting your question right follow below css: 如果我的问题正确,请按照以下css进行操作:

.box{
width: 100%;
height:100%;
border: 2px solid black;
background:white;

} }

You can use this way that css 你可以用css这种方式

.white-box {
background: #fff;
border-radius: 15px;
padding: 0 0 35px 0;
box-shadow: rgba(0,0,0,0.1) 0 4px 5px;
border: #eee solid 1px;
height: 100%;

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

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