數字函數-ceil()函數

ceil() 函數將一個數轉換成最接近於自己的整數,會將一個大於自身的任何小數轉換成大於本身1 的整數。也就是只做入,不做舍的計算:

>> ceil(2.0)
2
>> ceil(2.1)
3
>> ceil(2.6)
3
>> ceil(2.3%)
3%
>> ceil(2.3px)
3px
>> ceil(2.5px)
3px
>> ceil(2px / 3px)
1
>> ceil(2% / 3px)
1%/px
>> ceil(1em / 5px)
1em/px
.footer {
   width:ceil(12.3px);
}

編譯後的css 代碼:

.footer {
  width: 13px;
}

results matching ""

    No results matching ""