1
<div id="footer">
    <div>
    <h2>Revovation</h2>
    <p>Our mission is to provide the best handyman service at an reasonable price without sacrificing quality. You will be satisfy with our work knowing we take the necessary steps to meet your needs and get the job done right
    </p>
    </div>
    <div>
        <h2>Information</h2>
            <div>
                <ul>
                    <li>Blog</li>
                    <li>Services</li>
                    <li>Extras</li>
                    <li>Contact</li>
                </ul>
            </div>
            <div>
                <ul>
                    <li>Projects</li>
                    <li>Information</li>
                    <li>About us</li>
                    <li>Shop</li>
                </ul>
            </div>
    </div>
    <div>
        <h2>Renovation Office</h2>
        <ul>
            <li><img src="images/marker.png" alt="">Address</li>
            <li>Phone</li>
            <li>Email</li>
            <li>Fax</li>
            <li>Timings</li>
        </ul>
    </div>

</div>

edit: Adding css

#footer
{

    background  :  #282828; 
    border: 2px solid blue;
    font-family  :  verdana;
    position: relative;
     color : #8e9a8c;
}


#footer div
{
    background  :  #282828; !important;
    width  :  28%;
    border: 1px solid red;
    float : left;
    padding: 60px 0px 30px 40px;
}

blue border is for footer div and red border is for the divs inside it. I am floating inside divs to left. Why wont the outer div cover all three inner child divs? I have no clue whats going wrong in here!

Output Screenshot

Jay Wayne
  • 31
  • 1
  • 4

5 Answers5

3

This looks like a prime case of the floating children of an element collapsing the parent's height: https://css-tricks.com/snippets/css/clear-fix/

.clearfix:after {
    visibility: hidden;
    display: block;
    font-size: 0;
    content: " ";
    clear: both;
    height: 0;
    }
* html .clearfix             { zoom: 1; } /* IE6 */
*:first-child+html .clearfix { zoom: 1; } /* IE7 */

Simply add the class clearfix to the element who's height has collapsed, in this case:

<div id="footer" class="clearfix">
David Wilkinson
  • 4,880
  • 1
  • 17
  • 32
0

You can add a float property to your footer element :

https://jsfiddle.net/Ln2fy2a4/

#footer
{
background  :  #282828; 
border: 2px solid blue;
font-family  :  verdana;
position: relative;
color : #8e9a8c;
float: left;
}
Malcom
  • 320
  • 6
  • 18
0

You need to use the clearfix method if you have floated divs inside a parent div. Just add these ruels to your css file:

.clearfix:after {
     visibility: hidden;
     display: block;
     font-size: 0;
     content: " ";
     clear: both;
     height: 0;
     }
.clearfix { display: inline-block; }
/* start commented backslash hack \*/
* html .clearfix { height: 1%; }
.clearfix { display: block; }
/* close commented backslash hack */

And then add the clearfix class to the parent div.

Horia Rudan
  • 178
  • 10
0

add one property overflow: hidden to

#footer {
    background  :  #282828; 
    border: 2px solid blue;
    font-family  :  verdana;
    position: relative;
    color : #8e9a8c;

    overflow: hidden;
}
TusharG
  • 396
  • 1
  • 3
  • 18
-1

Here is what you are doing wrong. Just put this script instead of yours.

#footer
{

    background  :  #282828; 
    border: 2px solid blue;
    font-family  :  verdana;
    position: relative;
     color : #8e9a8c;
}
#footer-div
{
    background  :  #282828 !important;
    width  :  28%;
    border: 1px solid red;
    float : left;
    padding: 60px 0px 30px 40px;
}

Here is html code you have to put instead of yours

<div id="footer">
    <div id="footer-div">
    <h2>Revovation</h2>
    <p>Our mission is to provide the best handyman service at an reasonable price without sacrificing quality. You will be satisfy with our work knowing we take the necessary steps to meet your needs and get the job done right
    </p>
    </div>
    <div id="footer-div">
        <h2>Information</h2>
            <div>
                <ul>
                    <li>Blog</li>
                    <li>Services</li>
                    <li>Extras</li>
                    <li>Contact</li>
                </ul>
            </div>
            <div>
                <ul>
                    <li>Projects</li>
                    <li>Information</li>
                    <li>About us</li>
                    <li>Shop</li>
                </ul>
            </div>
    </div>
    <div id="footer-div">
        <h2>Renovation Office</h2>
        <ul>
            <li><img src="images/marker.png" alt="">Address</li>
            <li>Phone</li>
            <li>Email</li>
            <li>Fax</li>
            <li>Timings</li>
        </ul>
    </div>

</div>
pratik
  • 49
  • 7