Flo Flo - 10 months ago 49
HTML Question

Expand div to max width when float:left is set

I have something like that:

<div style="width:100px;float:left">menu</div>
<div style="float:left">content</div>

both floats are neccesary. I want the content div to fill the whole screen minus those 100px for the menu. If i dont use float the div expands exactly as it should. But how do i set this when float is set? If i use sth like


then the content div gets the size of the parent, which is either the body or another div which i also tried, and so of course it does not fit right of the menu and is then shown below.


Hope I've understood you correctly, take a look at this: http://jsfiddle.net/EAEKc/

<!DOCTYPE html>   
<html lang="en">     
        <meta charset="UTF-8" />    
        <title>Content with Menu</title>         
      .content .left {
      .content .right {

    <div class="content">
      <div class="left">
        <p>Hi, Flo!</p>
      <div class="right">  
        <p>you are looking for?</p>