html - Equal height flex items in flex columns -


i trying make list items in column have equal height inside list.

here have:

<ol>     <li>list item 1</li>     <li>list item 2</li>     <li>list item 3</li> </ol>  ol {    min-height: 100%;    display: flex;    flex-direction: column; }  ol li {     flex: 1; } 

i have tried: have attempted follow tutorial: https://css-tricks.com/boxes-fill-height-dont-squish/ no avail. think trouble has having set height: 100% every single parent element way html. can right?

my list nested , setting heights breaks layout. prefer work fluid heights.

i have tried: accomplishing divs instead of list. still, no luck.

any clues?

since you're using percentage height on flex container...

ol { min-height: 100%; } 

... need define height parent , root elements.

html (no changes)

<ol>     <li>list item 1</li>     <li>list item 2</li>     <li>list item 3</li> </ol> 

css

html, body { height: 90%; } /* new; needed child percentage heights work;                                set @ 90% demo purposes */ ol {    min-height: 100%;    display: flex;    flex-direction: column; }  ol li {     flex: 1; } 

demo: http://jsfiddle.net/kzl4305k/1/

i think trouble has with having set height: 100% every single parent element way html. can right?

yes, correct. if use percentage heights need specify height every single parent way root element (html). i've explained reason here:

my list nested , setting heights breaks layout. prefer work fluid heights.

you don't need set height parent elements if don't use percentages. try using min-height in pixels on flex containers, letting flex-grow: 1 deal height issue flex items.


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -