HTML/CSS image navigation menu -
so, i've been programming few years , have been dreading making website because html , css not programming languages, , reason confuse me no end!
here link jsfiddle have html , css code though show image and, on hover, display different image. remember doing in introductory course c.s. years ago.
after looking @ multiple examples of how simply, copying code , implementing images example code had own images, , still coming blank screen, i'm coming guys show me idiotic thing miss.
sorry in advance how elementary is!
html:
<body> <a href="#" class="about" title="learn more me!"></a> <a href="#" class="work" title="look @ made!"></a> <a href="#" class="contact" title="talk me!"></a> </body>
css:
.about { width:400px; height: 200px; display: block; background-size: contain; background-repeat: no-repeat; background-image: url(/images/about.png); } .about:hover { background-size: contain; background-repeat: no-repeat; background-image: url(/images/abouthover.png); } .work { width:400px; height: 200px; display: block; background-size: contain; background-repeat: no-repeat; background-image: url(/images/work.png); } .work:hover { background-size: contain; background-repeat: no-repeat; background-image: url(/images/workhover.png); } .contact { width:400px; height: 200px; display: block; background-size: contain; background-repeat: no-repeat; background-image: url(/images/contact.png); } .contact:hover { background-size: contain; background-repeat: no-repeat; background-image: url(/images/contacthover.png); }
my dir tree:
[site]- |—index.html | |—[ css ] | |—base.css | |—[ images ] | |—about.png | |—abouthover.png | |—contact.png | |—contacthover.png | |—name.png | |—namehover.png | |—work.png | |—workhover.png | [site]-
/images
should images
if relative path of index file on same level.
background-image: url(images/workhover.png);
dir/index.html
= ../images
go 1 directory , down images
dir/dir/index.html
= ../../images
go 2 directoris , down images
Comments
Post a Comment