Imoddedu Posted November 25, 2010 Share Posted November 25, 2010 Hey there! Here is an image what I currently have. As for the rollovers, they were originally planned to go over horizontally on the blue background, but instead they go down. Here is the code:HTML <div id="topnavbar"><a id="linkHome" href="#" title="Home"><span>Home</span></a><a id="linkPort" href="#" title="Portfolio"><span>Portfolio</span></a><a id="linkProj" href="#" title="Projects"><span>Projects</span></a><a id="linkAbou" href="#" title="About"><span>About</span></a><a id="linkCont" href="#" title="Contact"><span>Contact</span></a></div> CSS #topnavbar { background: url('images/main_bg.png'); background-repeat: repeat-x; height: 75px;}/* MainNavLinks */#linkHome { display: block; width: 100px; height: 75px; background: url('images/home.png'); }#linkHome:hover { background: url('images/home_on.png');} #linkHome span{ display: none;}/* */#linkPort { display: block; width: 100px; height: 75px; background: url('images/portfolio.png');}#linkPort:hover { background: url('images/portfolio_on.png');}#linkPort span { display: none;}/* */#linkProj { display: block; width: 100px; height: 75px; background: url('images/projects.png');}#linkProj:hover { background: url('images/projects_on.png');}#linkProj span { display: none;}/* */#linkAbou { display: block; width: 100px; height: 75px; background: url('images/about.png');}#linkAbou:hover { background: url('images/about_on.png');}#linkAbou span { display: none;}/* */#linkCont { display: block; width: 100px; height: 75px; background: url('images/contact.png');}#linkCont:hover { background: url('images/contact_on.png');}#linkCont span { display: none;} Link to comment Share on other sites More sharing options...
Ingolme Posted November 25, 2010 Share Posted November 25, 2010 Adding display: block to your links is causing them to take up all the horizontal space. Link to comment Share on other sites More sharing options...
dsonesuk Posted November 25, 2010 Share Posted November 25, 2010 display: block; is the opposite of display:inline; each element with display: block; (which is required to define area, height and width; for background image) will stack below the previous element. using float, will force the block elements to stack together horizontally, as long as total width of menu buttons does not exceed width of parent element #topnavbar. Link to comment Share on other sites More sharing options...
Imoddedu Posted November 25, 2010 Author Share Posted November 25, 2010 EDIT: I see! Float is a different property than display! Thanks very much. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.