Is it possible for inline-block element to auto fill the available width?

后端 未结 4 1934
悲&欢浪女
悲&欢浪女 2021-02-07 15:13

I have a

, which contains
and
, which themselve
4条回答
  •  攒了一身酷
    2021-02-07 15:46

    If your header, footer and wrapper have specific widths, then yes, you can have your main-container fill the available space. But if you're not specifying widths in your CSS, then you need to determine how big your main-container CAN be based on the rendered width of the containing element (wrapper). The only way to determine that width after the page loads is with javascript. If you want your site to have a dynamic width but still have your content (sub-navigation and main-container) fill the screen, you would either need to use javascript or percentages, and percentages can get ugly when you start looking at varying resolutions of monitors, laptops, etc...

提交回复
热议问题