视频1 视频21 视频41 视频61 视频文章1 视频文章21 视频文章41 视频文章61 推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37 推荐39 推荐41 推荐43 推荐45 推荐47 推荐49 关键词1 关键词101 关键词201 关键词301 关键词401 关键词501 关键词601 关键词701 关键词801 关键词901 关键词1001 关键词1101 关键词1201 关键词1301 关键词1401 关键词1501 关键词1601 关键词1701 关键词1801 关键词1901 视频扩展1 视频扩展6 视频扩展11 视频扩展16 文章1 文章201 文章401 文章601 文章801 文章1001 资讯1 资讯501 资讯1001 资讯1501 标签1 标签501 标签1001 关键词1 关键词501 关键词1001 关键词1501 专题2001
内联元素的padding-top属性
2020-11-27 18:50:47 责编:小采
文档

If 'height' and 'width' both have computed values of 'auto' and the element has an intrinsic ratio but no intrinsic height or width, then the used value of 'width' is undefined in CSS 2.1. However, it is suggested that, if the containing block's width does not itself depend on the replaced element's width, then the used value of 'width' is calculated from the constraint equation used for block-level, non-replaced elements in normal flow.

Otherwise, if 'width' has a computed value of 'auto', and the element has an intrinsic width, then that intrinsic width is the used value of 'width'.

Otherwise, if 'width' has a computed value of 'auto', but none of the conditions above are met, then the used value of 'width' becomes 300px. If 300px is too wide to fit the device, UAs should use the width of the largest rectangle that has a 2:1 ratio and fits the device instead.

注意加粗的内容,可替换元素是具有内部的宽,高,或者宽高比的。

总结:

对于input这种替换元素,margin和padding各方向均有作用,

对于span,a等这些不可替换元素,

  padding-left,padding-right均有效果,padding-top无效果。

  经评论中@meta-D的提醒,后经验证,padding-bottom无效,只是对border的样式产生了影响。配图请看评论。

  margin-right,margin-left均有效果,margin-top,margin-bottom无效果。

4.16更新:

  最近在看css权威指南的时候,书上写:非替换元素的内边距,边框和外边距对行内元素及其生成框没有垂直效果;也就是说,他们不会影响行内框的高度。(还是得多看书啊)

总感觉文章写的半吊子,先这样,大家可以看看下面的链接,等我再深入地挖一挖坑。

相关链接(需要楼梯越过高墙):

  http://maxdesign.com.au/news/inline/

  http://stackoverflow.com/questions/12468176/what-is-a-non-replaced-inline-element

  http://melon.github.io/blog/2015/03/07/inline-replaced-vs-inline-nonreplaced/

  http://reference.sitepoint.com/css/replacedelements

下载本文
显示全文
专题