February 22, 201115 yr So I am doing a basic web page for a friend of mine - nothing crazy, just 4 pages for the time being, but I have run into problems aligning the menu items (or problems with my technique, but thats for you guys to decide). Currently I have the page split into 4 divs - header/banner, navigation, content, and the footer - real simple straight down, top to bottom. I have 4 buttons that I would like to use as the navigation, but I want the entire web page centered and the buttons locked in the layout, so when the browser window scales, it cuts/moves as needed. When I center align them, they go too far and overlap into some of the graphics I made for the banner, left alignment drops them into the BG (obviously). #navigation { width:100%; height:75px; background-image:url(images/Slice_02.png); background-repeat:no-repeat; background-position:center; text-align: center; } <div id="navigation"> <a href="#"><img src="images/Nav/About.png"/></a> <a href="#"><img src="images/Nav/Recent.png"/></a> <a href="#"><img src="images/Nav/Customer.png"/></a> <a href="#"><img src="images/Nav/Contact.png" /></a> </div> So here's the real question: I used to build pages entirely with AP divs - slicing and just moving them into perfect arrangement and using a wrapper to center and laying content directly into the DIV field. I've been out of the loop for a while, so I was wondering which is the better web building convention between the two? Or if I am completely off of good coding practice point that out too! Should I re-slice and rebuild the website with AP divs and wrap, or is it better convention to use standard divs? Main reason I ask is because I plan on deploying wordpress on one page in the future and know little about how you can conform templates to wordpress... I figure it would be better to ask and be the idiot for a day than be the idiot later and have to completely re-deploy and re-code...
February 24, 201115 yr Its probably better to use standard divs for the building blocks. Within those divs you can use ap divs. Are you using some sort of wysywig by any chance?
February 24, 201115 yr Best way to do a menu is a <ul> containing links, like so: <div id="navigation"> <ul> <li id="about"><a href="#">About</a></li> <li id="recent"><a href="#">Recent</a></li> <li id="customer"><a href="#">Customer</a></li> <li id="contact"><a href="#">Contact</a></li> </ul> </div> That gives you more hooks on which to hang your styling, and gives you textual contents for the links - good for accessibility and SEO. If you want to use images for the links, set them as background-image on the <a> elements and use text-indent: -999em to move the text out of the visible area of the link. You'll need to set them as display: block and specify widths and heights. Best way to centre-align navigation is to float: left both the <ul> and the <li> elements, offset the <ul> left: 50% and the <li> right: 50% Edited February 24, 201115 yr by Renaissance-Design
February 28, 201115 yr Author I use dreamweaver for editor, but I'm not as versed as I am with Ai or Ps - I know no tricks and I basically code with what little knowledge I have haha... It seems that there is much more flexibility to just conform text links and forget images as links (I like using PNGs for transparency for what I see to match my designs). A lot of web design now span the page it seems like, and maybe it would be worth it to downscale the complexity to keep web coding simplicity... I was trying to keep the content dropping down from a main banner/header, centered on the page - but if there is no shortcut Ill just change it.
March 1, 201115 yr #navigation { width: /*total navigation width*/ height:75px; margin:auto 0 auto 0; text-align: center; } I would do something like this, the margin means it will be centred...it also means that rollovers can be used this way. Then just add the images as normal with links, then if need be just add margins to the images for some space between them. If you do add space (margins) to the images though, make sure you increase your total width accordingly.
Create an account or sign in to comment