0

https://i.stack.imgur.com/4nVnY.jpg here is a screenshot.

The areas marked in red are where the problems are. When I view the page in firefox it looks fine, in chrome there are tiny gaps, I don't deal with ie.

What is the correct way to size these divs such that each div will "connect" with other divs without leaving any gaps whenever the browser changes? something with jquery or js?

html:

<!doctype html>
<html>
    <head>
        <link rel="stylesheet" href="./css/main.css" />     
    </head>

    <body>  
        <div id="header">
            <h1>New York Tech Map</h1>
        </div>

        <div id="navlinks">
            <div class="topnav">
                <a href="">About Us</a>
            </div>
            <div class="topnav">
                <a href="">Contact Us</a>
            </div>
            <div class="topnav">
                <a href="">Sign Up</a>
            </div>
            <div class="topnav">
                <a href="">Help</a>
            </div>
        </div>

        <div id="sidebar">

        </div>

        <div id="map">

        </div>

        <div id="footer">
            &copy; 2012 NYC Tech Map
        </div>      
    </body>     
</html>

css:

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: #F0F0F0;
}

a { text-decoration: none; color: grey; }
a:hover{ color: red; }

#header {
    width: 100%;
    height: 75px;
    background: red;
    margin-top: -21px;
}

#navlinks { float: right; width: 80%;}

.topnav {
    width: 25%;
    height: 25px;
    float: left;
    padding-top: 5px;
    background: #2D2D2D;
    text-align: center;
    font-family: arial, sans serif;
    font-size: 15px;
    font-weight: bold;
}

#sidebar {
    width: 20%;
    height: 500px;
    float: left;
    background: blue;
}

#map {
    height: 80.8%;
    width: 80%;
    float: right;

}
.
.popa:hover {
    background: #D6D6D6;    
}

#footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 25px;  
    background: #2D2D2D;
    text-align: center;
    font-family: arial, sans serif;
    font-weight: bold;
    padding-top: 5px;
    color: grey;    
}
iCodeLikeImDrunk
  • 17,085
  • 35
  • 108
  • 169
  • Footer seems to be "connect"ing correctly. What's the problem with that? Show the HTML, using this CSS. – Vinayak Garg Apr 14 '12 at 04:57
  • @VinayakGarg edited with code. when i use 80% it has tiny gaps, its noticeable :( 81-85% the body will overlap with the footer – iCodeLikeImDrunk Apr 14 '12 at 05:03
  • using % for width is tricky because firefox & chrome round differently. Check [this](http://stackoverflow.com/questions/6614204/rendering-of-html-in-firefox-and-chrome) out – Yevgeniy Apr 14 '12 at 05:33

1 Answers1

0

it is better just resize dynamically, use js to get the window size then have that element adjust accordingly.

iCodeLikeImDrunk
  • 17,085
  • 35
  • 108
  • 169