是否有任何理由对内联元素使用padding-top和padding-bottom? [英] Is there ever any reason to use padding-top and padding-bottom for inline elements?

查看:204
本文介绍了是否有任何理由对内联元素使用padding-top和padding-bottom?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 http://www.maxdesign.com.au/articles/inline/ ,称为内联元素和填充的部分


虽然填充可以应用于内联元素的所有侧面,但只有左侧和右侧填充会影响周围的内容。


因此,看来对内联元素使用padding vertical(top,bottom)永远是没有意义的。


那是正确的吗?

解决方案

好吧,填充框是覆盖背景色的区域,边框是围绕它进行绘制,因此更改顶部和底部的填充可以更改内联元素的外观,即使它对周围的内容没有影响。

According to http://www.maxdesign.com.au/articles/inline/, the section called "Inline elements and padding" says

While padding can be applied to all sides of an inline element, only left and right padding will have an effect on surrounding content.

So in accordance with that, it seems that it is never ever any point to use padding vertical(top,bottom) for inline elements.

Is that correct?

解决方案

Well, the padding box is the area covered with the background colour, and the border is painted around that, so changing the padding top and bottom can change what the inline element looks like even if it has no effect on the surrounding content.

这篇关于是否有任何理由对内联元素使用padding-top和padding-bottom?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆