I have an html list that consists of several elements, each of which consists of some text and an image. I want the following:
- all items should fit on one page (no scroll bar)
- each element must have the same height (resize the image according to the height of the element)
- The image should use the remaining space in the list of elements that is not taken by the text
Edit: so to be clear, assuming the browser height is X, and there are n list items (li), each li must have a height of X / n pixels so that they all match the height of the browser without any scroll bar. And from there, inside each li, the text should take any space that it needs, and the image should fill the remaining space
I tried playing with height and maximum height but it doesn't seem to work. Should I change the html layout?
Here is the html code:
<html> <head> <style type="text/css"> </style> </head> <body> <div> <ul> <li> <div>title1</div> <img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"/> </li> <li> <div>title2</div> <img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"/> </li> <li> <div>title3</div> <img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"/> </li> <li> <div>title4</div> <img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"/> </li> <li> <div>title5</div> <img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"/> </li> <li> <div>title6</div> <img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"/> </li> <li> <div>title7</div> <img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"/> </li> <li> <div>title8</div> <img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"/> </li> </ul> </div> </body> <html>
source share