CSS: height- fill out rest of div?

前端 未结 7 1949
星月不相逢
星月不相逢 2020-12-10 10:13

i wonder if this is possible with simple css or if i have to use javascript for this?

i have a sidebar on my website. a simple div#sidbar it\'s normally about 1024px

相关标签:
7条回答
  • 2020-12-10 11:01

    you can do this with nested div tags. you have one specifying the width on the left, and then another left blank. To fill the rest of the other side you nest a 100% relative div inside the right side div. like so:

    <div style="width:100%">
      <div style="width:300px;background-color:#FFFF00;float:left">
      </div>
      <div style="margin-left:300px">
        <div style="position:relative;left:0px;width:100%;background-color:#00FFFF">
        </div>
      </div>
    </div>
    
    0 讨论(0)
提交回复
热议问题