1. This website uses cookies. By continuing to use this website you are giving consent to cookies being used.
    For information on cookies and how you can disable them visit our Cookie Usage page.
    Dismiss Notice

CSS Centering a sliced Navbar with CSS

Discussion in 'Web Development' started by skib, Nov 10, 2009.

  1. skib

    skib New Member

    Hello all,

    I'm having a hard time using CSS to center a navigation bar I sliced up.

    I made the Navbar in Photoshop, sliced it up and had Photoshop save it for the Web using CSS.

    The images display fine when viewed in a browser, but I've spent hours fiddling with the code, trying to get it all to be centered on the page. Does anyone know the solution?

    Here is a sample of the CSS Photoshop came up with:
    #Table_01 {
    position:absolute;
    left:0px;
    top:0px;
    width:950px;
    height:300px;
    }

    #abovebuttons {
    position:absolute;
    left:0px;
    top:0px;
    width:950px;
    height:175px;
    }
    And this is the HTML I'm trying to use:
    <div id="Table_01">
    <div id="abovebuttons"><img src="images/abovebuttons.jpg"></div>
    <div id="beforeartwork">
    <img src="images/beforeartwork.jpg" width="52" height="75" alt="">
    </div>

    Again, my goal is to have a sliced up Navbar centered at the top of the page. What am I doing wrong, or how could it be done?

    Please ask me any questions you need!;)
     
  2. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    try adding this as your fist line of code in the "css" file
    Code:
    body {margin: 0px;}
     
  3. skib

    skib New Member

    That doesn't change anything unfortunately.

    Do you want to see all the code, or just have me upload the files?

    Thanks for the help so far.
     
  4. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    zip them up and I'll look at them tomorrow
    rightnow my eyes are falling shut.
     
  5. skib

    skib New Member

    UPLOAD PROBLEMS:

    ZIP files gave me message "Upload of File Failed" (3.3 MB)

    Files separately gave me "Invalid file" (formats were .css and .html)

    Searching the forum for an answer gave me the error message:

    Thanks for the help, again.

    What next?

    EDIT: Tried to upload again today... no luck.
     
  6. skib

    skib New Member

    OK here. I uploaded the file to this directory on the website I am working on.

    www.gidgeworld.com/navbar.zip

    I know it's a wreck graphically/coding wise but I'm literally learning as I do this....

    Thanks again.
     
  7. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    Ok I got it give me some time, I'll get back to ya.
     
  8. skib

    skib New Member

    OK thanks. Even if it's just basic advice or directions, I'm not looking for someone to do the work for me, I'm trying to learn. I've just been through a gamut of sites that haven't helped...
     
  9. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    Hey skib haven't forgot you. I have been working on it while posting with member gashog, pm' ing, trying finish a new website.
    Can you post the psd file not merged?
     
  10. skib

    skib New Member

    Unfortunately no, I can't post it not merged. I didn't save it before I merged it. Let me know if there is anything else I can help you with.
     
  11. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    Let me work on this overnite.
    In the mean time send a PM to Mimoun he is a wiz at this stuff.
    Just ask him to take a look at your post.
    Ok
     
  12. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    Ok I got you started but you may not like it.
    Enclosed in the zip file is a readme.txt file take a look.
     

    Attached Files:

  13. skib

    skib New Member

    I understand you suggestions and I'm thankful for them. I know I need to redo the menu system anyway.

    I was under the impression that slicing an image and making certain parts of it clickable was the standard way to do menu systems. Is that true?

    Or would the large image usually be assigned to the background, while the smaller button images would be clickable? I don't think I saw that in the tutorials I went through on Youtube.

    Thanks again.
     
  14. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    If you are a Dreamweaver Fan and you plan it out. The way your slicing was done you would never have known it was clickable, due to being merged down. One would have to watch the mouse change states. Plus the files sizes really added up which would slow down the loading of your page.
    You really have to plan it out.
    That was the direction I was going in and enclosed in the zip file.

    A method which works well is to save your psd file and not merge it before slicing. There is a slice tool which will pick all the layers, but if you must merge it at least go back and undue it, re-save the file.
    I usually make my graphic, save it as psd, a lot of times I have several psd files for different parts which makes them reusable for other projects. I will slice out the part I need and save it in my images directory, pace it on the canvas, and code my css file. This way I avoid the dreaded tables. When laying out the parts in DW, I also stay away from the absolute divisions what used to be called layers. I'm am in the hand coding camp and really have no love for DW. It has it's good points and I use it at times, but for me it's a chaotic mess which needs a bottom up re-write. A biz friend bought me Adobe Design Premium CS3 so we could be on the same page, as he put it, when working together. Funny thing I would finish up hours before him doing it the the old fashion way - that's just me. Now Photoshop I like.