Hello everyone. I have been looking for an answer to this question for the past few days but I just can’t seem to figure out what I am doing wrong. It is a really basic issue it seems but I have not the slightest idea how to correct it.
Basically, I have 8 images (I realize that you can decrease this number to lessen HTTP requests but I am not worried about that at this point in time) to create a box with rounded corners. Eight divs are used (inside a container div) to create a grid of these images (with 3 rows and 3 columns). I used absolute positioning to position each image correctly in the grid. The first two rows of divs display perfectly but the last one doesn’t.
I assume that this happens because I have not set a definite height or width to the container div. It re-sizes according to size of the browser window.
Below is a screenshot that shows exactly what happens: (grid lines show where the div borders are)
Thank you very much everyone for all your help! Unfortunately, it still isn’t working.
By default borders aren’t displayed for divs in any case but I did add “border-style: none;” to the divs to see what would happen but this (as expected) had no effect. I also tried setting the border style to solid and the border width to 1. Again, this did not solve the problem but if you are interested in how it looks after applying these properties, here is a screenshot: (note that all divs including the containing div have a borders around them)
Was that directed at me or in response to cooper.semantics? If it was for me, I am not quite sure what you mean. Could you please elaborate?
Yeah, the reason I am using left and right properties instead of specifying the width and height of the containing div is that I need the div to re-size depending on the size of the window. I think that this is what is causing the issue with the positioning of the last row of divs.
Wow. I feel extremely stupid now! Thanks for pointing that out!
I don’t know why I did that for the CSS comments. They aren’t in my actual code (I just added them for some additional explanation) which is probably why I didn’t notice.
As for the ending div tag: Wow. Just wow. I can’t tell you how long I sat there staring at that code trying to figure out what exactly I did wrong. Oh well, now I can continue my project!
Thanks again to everyone that contributed and helped me find the solution to my problem. I have been truly overwhelmed by how many people pitched in to help. I am glad I stumbled upon this community. Thank you!
Sorry about that, I had that code from a different thread and I guess somehow it got onto this thread by mistake. I thought I deleted it when I posted but I guess it didn’t happen