对a question I've recently asked的积极回应让我对浏览器如何呈现网页感到好奇。
我发现this article非常有趣,但很多事情都在我头上。
特别是,我对渲染背景大小值背后的逻辑感兴趣。
我对链接问题的首选答案包含对contain
和cover
值的有用建议:
if (aspect ratio of container > aspect ratio of image)
image-height = container height
image-width = aspect-ratio-preserved width
else
image-width = container width
image-height = aspect-ratio-preserved height
if (aspect ratio of container > aspect ratio of image)
image-width = container width
image-height = aspect-ratio-preserved height
else
image-height = container height
image-width = aspect-ratio-preserved width
另外,假设在渲染过程中检查了类似的东西,它是否会在浏览器中发生变化?
提前感谢任何建议。