Hey Guys! I'm trying to transition from tables to div's for my layout. I've been setting up this very simple layout in css but cant seem to get it to display properly with my images. I'm uploading the files to this thread so it's easier to access the images along with the html/css code. The border for each css style is for troubleshooting purposes, but I can't seem to get my images to display. Any ideas or suggestions are appreciated. Thanks in advance.
Thanks a bunch coothead....I saw that it displayed properly. Awesome job! I haven't compared the code, but I'm sure I'll learn plenty from the comparison. Thanks again man!
I was just looking at the code and learning from it as much as I can. I'm curious though how did you go about getting the measurements for the following code in pixels:
I've learned to look at the image properties to set the width and height of the div for a specific image. That is what I'm seeing for the the div navigation but not the others. I'm curious to see how you went about that. Thanks for the big help so far. It is much appreciated.
the "header-bg.gif" - (849x162 pixels) - was made by joining together your "ImprovedFitness_01.gif" - (289x163 pixels)
and the "ImprovedFitness_Nav.gif" - (560x162 pixels).
Before joining, as your images had slightly varying heights, I sliced 1px from the bottom of the "ImprovedFitness_01.gif".
In the CSS, the containing div - "#page" - was given the width of 849px and centered horizontally with "margin:auto".
...the "background-position:0 0;" sets the starting point for the Home section of "navigation-bg.gif".
To display the About Me section, which begins after the Home section, we move the "navigation-bg.gif" to the left by a value equal
to the width of the previous section - 69px.
This gives "background-position:-69px 0; as the starting point for the About Me section.
For each section, the process is repeated - adding together the widths of the previous sections and then moving the "navigation-bg.gif"
to the left by that value.
I really hope that this long-winded explanation helps.
Thanks for getting back to me. The idea with using sprites is great! I get that 100% but am still having trouble understanding the header measurements. Where did you happen to come up with the number for 96px. I guess once I know that, I'll probably get what I'm missing. Thanks again!
Gotcha...actually looking at the css code and manipulating the numbers by playing around, I realize that it's not the numbers that were throwing me off, but it was the padding and height added together to equal height of the actual header image. I needed to get my head around to seeing the "big picture" and how it was functioning. Thanks a lot for your help. It is really much appreciated.
Ok...I realized why my images were not showing up from the css style sheet...
for some odd reason, index.html was referencing the css file because the background color would show up but not the background images.
So, I looked line by line again at your code and compared to mine. I realized that you put the css file in a sub folder css instead of leaving it in the root folder. When I did the same and made the index file reference css/styles.css, the background images all showed up. I have been pulling my hair out for sometime now because of something so small such as this but I will not forget this ever again. Not sure why the stylesheet needs to be in its own subfolder, but I will not forget it ever again LOL!
By habit, I create folders for CSS and javascript files, when coding, as there may often be more than one.
Call it good housekeeping.
coothead
hmm..that is odd since I put my stylesheet into a folder and referenced it by ../css/styles.css and it works as opposed to before when it was in its root folder being referenced as ../styles.css...it was the difference between my images showing up and not showing up.
Bookmarks