Forum Moderators: not2easy
i will first show the <div> which did work:
In html:
<div id="home"><a href="/Website%20bertus/website%20bertus.html"><img src="/image2/home.jpg" alt=" " width="109" height="42" /></a></div>
in css:
#home
{
background-image:url(/image2/homev.jpg);
}
#home a {display:block}
#home img {width:100%; height:100%;}
#home a:hover img {visibility: hidden;}
when i try that whit this <span> code it doesn't work:
<span id="home"><a href="/Website%20bertus/website%20bertus.html"><img src="/image2/home.jpg" alt=" " width="109" height="42" /></a></span>
does someone knows how i can fix this?
.navlink {float:left;}
and add the class to the nav elements
<div id="home" class="navlink"><a href="/Website%20bertus/website%20bertus.html"><img src="/image2/home.jpg" alt=" " width="109" height="42" /></a></div>
<div id="aboutus" class="navlink"><a href="/Website%20bertus/website%20bertus.html"><img src="/image2/home.jpg" alt=" " width="109" height="42" /></a></div>
That should get them to line up;
or if you wanted to you could lose the div and span completly and put
a.navlink {display:block; float:left;}
a.navlink img {width:100%; height:100%;}
a:hover.navlink img {visibility:hidden;}
Just out of curiosity why do you need the 100% width and height on the image?
[edited by: BadBoyMcCoy at 10:51 am (utc) on Oct. 17, 2008]
css:
ul.navlink li { display: inline;
list-style-type: none;
}ul.navlink {
margin: 0px;
padding: 0px;
}
#home
{
width:109px;
height:42px;
background-image:url(/image2/homev.jpg);
}
#home a:hover img {visibility: hidden;}
html:
<ul class="navlink"><li id="home"><img src="/image2/home.jpg" alt="" width="109" height="42" /></li></ul>
Just out of curiosity why do you need the 100% width and height on the image?don't know i just did copy that from some internet site, i know the basics of css but not the more advanced things
I'm afraid the source of your problems are from copying from others -which might be a problem in itself considering copyright- and doing it from others who didn't understand what they had themselves or in a context where it's not needed anymore.
Often when I look at CSS it's stuffed with things where it's just not clear as to why the author did add it. I guess often it's something one added out of ignorance, a test that got left in, or just something that developed due to changes. Often it's also there to create some side effect in e.g. IE.
Things do deteriorate with old age and ongoing maintenance.
But if you create something new, don't just settle for "it works". Make it beautiful, easy to maintain, well documented.
And above all do understand all that's in there. Have some pride in your work!