June 4, 200818 yr Hi people, I have started building a website, and am having a slight hiccup... Basically I have made the page, using mostly relative positioning, however due to this I now have a big gap at the bottom of the page. It appears that each Div has stacked on top of each other from its initial position, leaving a gap at the bottom of the page. Down to the point - Why has it done this, and how can I get rid of it? CSS File: /* TEMPLATE CSS */ #menu {font-size: 15px; color: #ffffff; background-color: #000000; padding: 6px; border-style: solid; width: 600px; border-width: thin; position: relative; top: 10px;} /* INDEX.PHP CSS */ .fpgrid {position: relative; top: 20px; color: #ffffff; font-size: 32px;} #pagetitle {color: #ffffff; font-size: 20px;} #indexgridpicnursery {position: relative; left: -255px; top: 0px;} #indexgridpicschool {position: relative; left: -131px; top: -67px;} #indexgridpicwedding {position: relative; left: -6px; top: -137px;} #indexgridpicfineart {position: relative; left: 116px; top: -210px;} #indexgridtextnursery {position: relative; left: -112px; top: -115px;} #indexgridtextschool {position: relative; left: 1px; top: -180px;} #indexgridtextwedding {position: relative; left: 133px; top: -250px;} #indexgridtextfineart {position: relative; left: 248px; top: -320px;} #indexcopyright {position: relative; left: 0px; top: -200px; color: ffffff; } Web page: http://www.secondlookphotography.co.uk/ Any help regarding this problem is greatly appreciated! .. its driving me nuts!!! **Update: I just figured that I can use body {overflow: hidden;}, and this fixes the problem visually. However, I feel that this is a mere cover up for my mistakes, and if anyone knows a proper method to get rid of this I would rather do it properly!
June 4, 200818 yr Hi webbhost, Instead of using relative positioning as you are, I would be inclined to use floats and margins. I suggest putting a Doctype at the top of your code to give different browsers a clue as how to render the page. You are also using deprecated tags such as center which should be avoided if at all possible. You could also try and move away from table based layout and use pure css for your layout/presentation. I hope that helps a little
June 5, 200818 yr Unfortunately I didnt see the original problem before you fixed it, but there is still more you can do to help make your site display consistently accross browsers. and maybe more how you want it to? Your category divs are all contained within a <span> element - span is an inline element and you shouldnt have block level elements (eg divs, h1+ etc) inside them. If you make this span a div with an id, it would be more acceptable coding. Also, you dont need to give each one of your category divs an id. Since they are all taking the same format, why not give them all the same class and style that with css so that it is repeated for each. As ElanMan said above, floating these divs would give the same result and need such intircate styling as relative positioning. something like: <div id="container"> <div class="category"><img /></div> <div class="category"><img /></div> <div class="category"><img /></div> <div class="category"><img /></div> <div class="category"><img /></div> </div> Can be more explicit if you need it it. Hope this helps.
June 6, 200818 yr Author Hi Kudos... Unfortunately i have not yet fixed the problem. I had merely switched body overflow to hidden to hide the problem for now. I have now deleted the body overflow property, and the inital problem is visable again. Please take a look. This is really doing my head in!.. I dont think I can use margins to position the elements because of the exact location of pictures... Im going to do some experimenting with the float value to see if I can shed any light again.. P.S. I think I may have got span and div's mixed up the wrong way around... Should I be using ALL Div's for the page mentioned, or should I swap the Div's to Spans and span to div? Wish me luck... if you can give me any more information about float that will help me, that would be great!.
June 6, 200818 yr Author Hi, Ok, so i figured now that by placing a wrapper across the whole page which is centered on page I can get the page height needed... Then I can use float: left; position: relative; top: ##xpx; left: ##px; On each item to get it where it is required. As the elements are set to float, this does not leave a big dull gap at the bottom of the page. It does however mean that I have to set a height on the page wrapper to ensure that the whole page is accessable and does not disappear of the bottom of the screen. Would this be considered acceptable, or should I be taking a different approach? (P.S. i am doing testing on a seperate file so its not visible on site). It seems to work either way - the only draw back is that I would have to assign each page its own wrapper tag to ensure that the page goes to the correct height. This is not a problem however as each page "will" be importing a universal CSS file for text formatting etc, and a page specific CSS file for individual elements.
Create an account or sign in to comment