Search code examples
htmlcssfooter

making a responsive footer with 3 divs inside


I want to make a responsive footer with three sections, so one div as the footer than 3 equal size divs in a row within the footer div. I used to use a table with 1 row and 3 columns for this. But I have no idea how to do it with divs and css.

MY CODE SO FAR

<div class="push"></div>
    </div>
<div class="footer">
<div></div>
<div></div>
<div></div>
        <p>&nbsp;</p>
    </div>

Thank inadvance


Solution

  • Using % and float

    html

    <div id="footer">
      <div class="footer-section"></div>
      <div class="footer-section"></div>
      <div class="footer-section"></div>
    </div>
    

    css

    #footer {
      width:100%; 
    }
    .footer-section {
      float:left;
      width:33%;
    }
    

    Using display table - More info

    html

    <div id="footer">
      <div class="footer-row">
        <div class="footer-section"></div>
        <div class="footer-section"></div>
        <div class="footer-section"></div>
      </div>
    </div>
    

    css

    #footer {
      display:table;
      width:100%;
    }
    .footer-row {
      display:table-row;
    }
    .footer-section {
      display:table-cell;
    }