Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Shilpa K
Shilpa K
12,722 Points

Preventing Divs from Overlapping on my site

When I re-size the browser to a small height or width, the three image divs (.main-links) over lap the .pink-block div. I am having trouble keeping the three images positioned below the div and staying there when the browser is resized. Could someone help me with this? (Within my CSS, please refer to the PINK BLOCK CODE and GIANT LINKS code) Thanks!

HTML

<!DOCTYPE html>
<html>

    <head>
        <meta charset="utf-8">
        <title> Shilpa Kumar | Web Developer </title>
        <link rel="stylesheet" ref="normalize.css">
        <link href='http://fonts.googleapis.com/css?family=Droid+Serif' rel='stylesheet' type='text/css'>
        <link href='http://fonts.googleapis.com/css?family=PT+Sans:400,700' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" type="text/css" href="normalize.css">
        <link rel="stylesheet" type="text/css" href="style.css">
        <link rel="stylesheet" type="text/css" href="responsive.css">

    <body>

    <!-- <div id="head-bar">
        <div id="logo">
            <h1 class="logo">
                <a href="http://www.shilpakumar.me"><img src="shilpa-logo.jpg" alt="Shilpa Kumar | Web Developer"></a>
            </h1>
        </div> 
    </div>  -->
        <header>
<div id="head-bar">
        <div id="logo">
            <h1 class="logo">
                <a href="http://www.shilpakumar.me"><img src="images/shilpa-logo.jpg" alt="Shilpa Kumar | Web Developer"></a>
            </h1>
        </div> 
    </div> 
        <nav>
            <ul>
                <li><a href="index.html">Home</a></li>
                <li><a href="portfolio.html">Portfolio</a></li>
                <li><a href="resume.html">Resume</a></li>
                <li><a href="connect.html">Connect</a></li>
            </ul>
        </nav>

        </header>



    <div width="100%" id="pink-block" class="wrapper">
        <p> Hi. My name is Shilpa Kumar.</p> <br>


    </div>



<section class="big-links" "wrapper">   

    <div class="big-portfolio">
        <a href="portfolio.html">
            <img height="100%" width="100%" src="images/portfolio-link.jpg" alt="Portfolio-Link"> 
                    <span class="image-text">Portfolio</span>
        </a>
    </div>

     <div class="big-logo">
        <a href="resume.html">
            <img height="100%" width="100%" src="images/giant-logo.jpg" alt="Logo"> 
                    <span class="image-text">Resume</span>
        </a>
     </div>

     <div class="big-profile">
        <a href="connect.html">
            <img height="100%" width="100%" src="images/profile.jpg" alt="Profile-Picture"> 
                    <span class="image-text">Connect</span>
        </a>
     </div>

 </section>

     <script src="http://code.jquery.com/jquery-1.11.0.min.js" type="text/javascript" charset="utf-8"></script>
     <script src="fade.js" type="text/javascript" charset="utf-8"></script>

    </body>

    <footer>
        <p>&copy; 2014 Shilpa Kumar.</p>
    </footer>


</html>

CSS

ody {
    font-family: 'PT Sans', sans-serif;
}

img {
    max-width: 100%;
}
/**********************
HOME: HEADER
**********************/
.logo {
    position: fixed;
    margin: 0 auto;
    height: auto;
    float: left;
    max-width: 100%; 
    clear: both;
    z-index: 1000;  
}

nav {
    width: 100%;
    text-align: center;
    padding: 5% 25%;
    margin-top: -3%;
    margin-left: -1%;
    position: fixed;
    font-family: 'PT Sans', sans-serif;
    background-color: white;
}

/*******************************
HOME: NAVIGATION
*******************************/

nav li {
    display: inline-block;
    padding: 2%;
    color: #FA5882;
}

nav a {
    padding: 10px;
}

nav ul {
    list-style: none;
}

/*******************************
HOME: PINK BLOCK
*******************************/

#pink-block {

    position: absolute;
    max-width: 100%;
    width: 100%;
    top: 50%; 
    margin-bottom: 100%;
    z-index: -1;

    text-align: center;
    background-color: #FE2E64;
    color: #FFFFFF;
    font-family: 'Droid Serif', serif;
    font-size: 2em;

}

/*******************************
HOME: GIANT LINKS
*******************************/


/*.wrapper {
    overflow: hidden;
    display: clear;
}*/

.big-links {

    position: absolute;

    top: 50%;
    left: 50%;
    margin-top: 37%;
    margin-left: -50%;
    z-index: -1;

}

.big-portfolio, .big-logo, .big-profile {

    width: 33%;
}

.big-portfolio {
    float: left;

}


.big-logo {
    display: inline-block;

    }


.big-profile {
    float: right;

}

I'm not sure how to solve your issue, but one thing I noticed is this line:

<section class="big-links" "wrapper">

should be

<section class="big-links wrapper">

wrapper needs to be in the same set of quotes for the class attribute, space separated.

1 Answer

It's because you've absolute positioned the #pink-block element. Try changing the top attribute to 38% rather than 50%.