Gecko 与 Webkit:内联块内的填充
这是显示我的问题的小提琴: http://jsfiddle.net/7QaXL/1/
在 webkit 中基于浏览器的
的填充似乎将图像向上推,这不是我想要的。
所以我的问题是:
- 什么是正确的行为(根据规范)?
- 如何获得六个相同高度的块,内部元素带有填充,而不改变它们的对齐方式?
Here's the fiddle showing my problem: http://jsfiddle.net/7QaXL/1/
In the webkit-based browsers the padding of the <p>
s seem to push the images up, which is not what I want.
So my questions are:
- What is the correct behavior (according to the specs)?
- How can I get six blocks of the same height, with inside elements with padding, without changing their alignments?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,我无法复制你的问题。其次,我会尝试使用这样的东西:
这在语义上更有意义,因为现在细节与相关图像相关联,并且此标记将允许您更好地控制样式。
figure
和figcaption
是 HTML5 元素,如果您需要任何进一步的帮助,请告诉我!编辑:经过进一步探索这个问题,我发现您遇到的问题(据我所知)与
display: inline-block;
及其自然行为有关。如果您用float: left;
替换该属性并给出无序列表overflow: hide;
(或使用clearfix 技术),问题应该得到解决。Firstly, I can't replicate your problem. Secondly, I would try using something like this:
This makes much more sense semantically as now the details are tied to the relevant images, and this markup will allow you to have greater control over the styling.
figure
andfigcaption
are HTML5 elements, if you need any further help just let me know!EDIT: Upon further exploration of the issue I have discovered that the issue you are encountering (as far as I can tell) is to do with
display: inline-block;
and its natural behaviour. If you replace that property withfloat: left;
and give the unordered listoverflow: hidden;
(or use a clearfix technique) the problem should be resolved.