Date
Oct. 26th, 2024
 
2024年 9月 24日

Post: max-height: x% doesn't work on Chrome

max-height: x% doesn't work on Chrome

Published 12:05 May 13, 2016.

Created by @ezra. Categorized in #Programming, and tagged as #CSS.

Source format: Markdown

Table of Content

Some times using percentages for fluidity in layouts is tricky because you have to deal with containers and border-type things.

Look in to using viewport units and learn some thing about it on css-tricks and caniuse will show you how well it's supported.

Essentially you can say:

<div style="height: 50vh;">...</div>

meaning a div element of 50vh height where 1vh is defined as the value of 1% of the viewport's height.

Pinned Message
HOTODOGO
The Founder and CEO of Infeca Technology.
Developer, Designer, Blogger.
Big fan of Apple, Love of colour.
Feel free to contact me.
反曲点科技创始人和首席执行官。
开发、设计与写作皆为所长。
热爱苹果、钟情色彩。
随时恭候 垂询