搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

percentage-based vertical positioning dependent on block width?

  • 1 个回答
  • 6 人有此问题
  • 2 次查看
  • 最后回复者为 schwal

more options

I seem to have found an issue when firefox is positioning blocks based on percentage values and margin offsets.

in short, look at this page: http://akos.maroy.hu/~akos/frontend/experiment/awake.html

the intended size of the image section is 75% of the available area, both vertically and horizontally. the intended location of the image section is so that the it's in the middle both vertically and horizontally.

while this works horizontally, it seems that the vertical position of the image depends on the horizontal width of the window. if one changed the width of the window, the image will shift vertically.

I seem to have found an issue when firefox is positioning blocks based on percentage values and margin offsets. in short, look at this page: http://akos.maroy.hu/~akos/frontend/experiment/awake.html the intended size of the image section is 75% of the available area, both vertically and horizontally. the intended location of the image section is so that the it's in the middle both vertically and horizontally. while this works horizontally, it seems that the vertical position of the image depends on the horizontal width of the window. if one changed the width of the window, the image will shift vertically.

被采纳的解决方案

This is not exclusive to Firefox. Your problem is that margin-top uses "%" to mean "% of width". http://www.w3schools.com/cssref/pr_margin-top.asp

定位到答案原位置 👍 1

所有回复 (1)

more options

选择的解决方案

This is not exclusive to Firefox. Your problem is that margin-top uses "%" to mean "% of width". http://www.w3schools.com/cssref/pr_margin-top.asp