搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

Learn More

percentage-based vertical positioning dependent on block width?

  • 1 回覆
  • 6 有這個問題
  • 25 次檢視
  • 最近回覆由 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