当填充集很小时,为什么只有padding-top和padding-left工作

时间:2017-07-24 05:00:14

标签: css padding

我刚开始学习CSS,所以我的问题非常基础。 如图所示,如果设置填充:10px;它的结果,似乎只有顶部和左侧工作,为什么会发生这种情况,我的意思是,如果使用工作流程,它应该是最后两个底部还是左边工作?

enter image description here

4 个答案:

答案 0 :(得分:0)

你的容器很长,这就是bottonright填充看不到的原因

如果你想从bottomright提供填充也有很多方法

padding-top
padding-right
padding-bottom
padding-left

//例如

padding: 25px 50px 75px 100px;

top padding is 25px
right padding is 50px
bottom padding is 75px
left padding is 100px

答案 1 :(得分:0)

如果我没错,这就是你要做的事情

.wrapper{
  width: 100%;
  height: 200px;
  border: 1px solid #888;
}
.content{
  padding: 10px;
  margin: 10px;
  border: 1px solid red;
  display: inline-block;
}
<div class="wrapper">
  <div class="content">
    some content
  </div>
</div>

答案 2 :(得分:0)

我也遇到了同样的问题。将 box-sizing 属性设置为 border-box 后,问题就解决了。

.container{
  padding:25px 15px;
  box-sizing:border-box
}

答案 3 :(得分:-1)

尝试使用代码段,如果不起作用,请尝试使用Sub MonthlyStage2() Dim beginRow As Long, endRow As Long, chkCol As Long, rowCnt As Long, r As Range, tmpR As Range beginRow = 13 endRow = 500 chkCol = 2 For rowCnt = beginRow To endRow If Cells(rowCnt, chkCol).Value Like "*MR0*" Then If r Is Nothing Then Set r = Cells(rowCnt, chkCol) Else Set tmpR = Cells(rowCnt, chkCol) Set r = Union(r, tmpR) End If End If Next rowCnt r.EntireRow.Hidden = True End Sub Sub stage2() Dim rng As Range, cell As Range, ContainWord As String, LR As Long, i As Long, r As Range, tmpR As Range LR = Range("B" & Rows.Count).End(xlUp).Row For i = LR To 2 Step -1 If Range("B" & i).Value Like "*MR0*" Then If r Is Nothing Then Set r = Range("B" & i) Else Set tmpR = Range("B" & i) Set r = Union(r, tmpR) End If End If Next i r.EntireRow.Hidden = True End Sub

&#13;
&#13;
!important
&#13;
.container{
  height:300px;
  width:300px;
  border:5px solid #000;
  padding:50px;
}
.box{
  height:20px;
  width:80px;
  border:1px solid #000;
  float:left;
  padding:5px;
}
&#13;
&#13;
&#13;