July 4, 201412 yr I'm trying to make a good, responsive/scaleable website but am having a problem with the basic design. I will post the code below. When resized very small, so the larger text overflows, that text goes beneath its own div and past the footer underneath, into a white space. I'll attach a screenshot to show this. I don't really understand why the div is not scaling to accomodate the text. The footer is obviously a problem in the screenshot too, but not the one I'm currently focusing on. Please let me know if this isn't explained adequetely Sorry I don't have this up live so you can look at it properly... CSS: *{ margin:0;padding:0; } html, body { margin:0; height:100%; font-size:62.5%; } a:link, a:visited, a:active { text-decoration:none; color:inherit; } a:hover { text-decoration:none; color:#CDFAFF; } #wrapper { height:100%; width:100%; position:relative; } #main { background-color:#E6FDFF; background-image:url('images/dia.png'); background-repeat:no-repeat; color:#B28A6C; height:100%; width:100%; font-family:"Lucida Bright", "DejaVu Serif", Georgia, serif; font-size:6em; margin:0; position:absolute; } #footer { width:100%; text-align:center; margin:0; padding:.7%; min-height:10px; top:95%; word-spacing:2.5em; background-color:#B28A6C; font-family:"Lucida Bright", "DejaVu Serif", Georgia, serif; color:#FFE2CD; font-size:.5em; position:absolute; } .hometext { font-size:2.2em; top:30%; left:30%; max-width:30%; min-width:25%; margin:0; position:absolute; } HTML: <body> <div id="wrapper"> <div id="main"> <p class="hometext">test text<br> (more text)</p> <div id="footer"> ♦ <a href="">about</a> ♦ <a href="">portfolio</a> ♦ <a href="">contact</a> ♦ </div> </div> </div> </body> Edit - the absolute positioning seems to be causing the problem... still don't really understand why, though - is there a way to get around this? Edited July 4, 201412 yr by rhubarblover
July 7, 201412 yr Edit - the absolute positioning seems to be causing the problem... still don't really understand why, though - is there a way to get around this? With absolute positioning, you need to declare the container's height, which is a pain; all other position states can manage auto-height's. If you intend to continue using absolute positioning (there could be an alternative solution), then you'll have to declare the height; properties like overflow: hidden won't take effect. One work-around is to write a piece of jQuery that gets the container's height on page-load with the content in and then apply absolute position via jQuery, so the container's height (automatically adjusted by the content) will be calculated first, then applied, then made to be position absolute.
July 8, 201412 yr Why are you using position absolute here, looking at your screenshots if the brown coloured bar is last in your source then it will be at the bottom of the page from the default document flow. If you need it to be pushed down then just give a sibling node (one that contains your page content) a min height. Also dont use ID's in your css. ID's should be used for js targeting. Edited July 8, 201412 yr by rbrtsmith
Create an account or sign in to comment