Reputation: 131
I have images for my navigation bar that I made in Photoshop. How would I create a black background and have them displayed in a vertical row down the left side during a resize? Once it resizes they drop into the white and are not seen. Also if you are using Chrome you will have to hit the top left logo to move the nav images up for some reason..this is the only browser this does this in. enter link description here
css:
/*---Navigation---*/
nav{
float: right;
margin-top: 12px;
margin-right: 25px;
}
nav a: {
padding: 15px;
}
#contact{
padding: 4px;
}
#bio{
padding: 4px;
}
#photography{
padding: 4px;
}
#design{
padding: 4px;
}
#sketches{
padding: 4px;
}
#web{
padding: 4px;
}
html:
<header>
<a href="index.html" id="homeLogo" title="home"><img src="images/paintLogo.jpg" alt="Ryan Warner Eyemusic"></a>
<nav>
<a href="contact.html" id="contact"><img src="images/links/contact.png"
onmouseover="this.src='images/links/contactHover.png'" onmouseout="this.src='images/links/contact.png'"></a>
<a href="bio.html" id="bio"><img src="images/links/bio.png"
onmouseover="this.src='images/links/bioHover.png'" onmouseout="this.src='images/links/bio.png'"></a>
<a href="photography.html" id="photography"><img src="images/links/photography.png"
onmouseover="this.src='images/links/photographyHover.png'" onmouseout="this.src='images/links/photography.png'"></a>
<a href="design.html" id="design"><img src="images/links/design.png"
onmouseover="this.src='images/links/designHover.png'" onmouseout="this.src='images/links/design.png'"></a>
<a href="sketches.html" id="sketches"><img src="images/links/sketches.png"
onmouseover="this.src='images/links/sketchesHover.png'" onmouseout="this.src='images/links/sketches.png'"></a>
<a href="web.html" id="web"><img src="images/links/web.png"
onmouseover="this.src='images/links/webHover.png'" onmouseout="this.src='images/links/web.png'"></a>
</nav>
</header>
Upvotes: 0
Views: 275
Reputation: 10976
Getting it on a small button on the side like the starbucks page is another story, but I'll help you out with your original request.
float: left;
header
(it prohibits it from expanding)overflow: auto;
on your header
& overflow: hidden;
on your nav
to clear the floats. (You may also use the clearfix
method but this one's easier).Now your links will stay in the black when resizing. If you want it to become an openable button when smaller than, say 480px, you'll have to use media queries.
Notes:
mouseover
& mouseout
on your links to toggle the image. However, it's more efficient to use the CSS :hover
selector, eg. nav a:hover { background-image: url(...)
title
attribute.Upvotes: 1