I've set background-image
on a couple of span
elements, but they aren't showing up, I think because my height
and width
settings are being ignored.
HTML source:
<div class="textwidget">
<a href="#" title="Start here"><span id="starthere" class="sidebar-poster"></span></a>
<a href="#" title="Primary documents"><span id="#primarydocs" class="sidebar-poster"></span></a>
<a href="#" title="Donate"><span id="donate" class="sidebar-poster"></span></a>
</div>
CSS:
span.sidebar-poster {
margin-bottom: 10px;
background-repeat: no-repeat;
width: 160px;
}
span#starthere {
background-image: url(/betatesting/wp-content/themes/dynamik/css/images/brunelwantsyou180.jpg);
height: 285px;
}
span#starthere:hover {
background-image: url(/betatesting/wp-content/themes/dynamik/css/images/brunelwantsyou_hover.jpg);
}
span#primarydocs {
background-image: url(/betatesting/wp-content/themes/dynamik/css/images/brunelwantsyou180.jpg);
height: 285px;
}
span#primarydocs:hover {
background-image: url(/betatesting/wp-content/themes/dynamik/css/images/brunelwantsyou_hover.jpg);
}
span#donate {
background-image: url(/betatesting/wp-content/themes/dynamik/css/images/donatebutton.jpg);
height: 285px;
}
span#donate:hover {
background-image: url(/betatesting/wp-content/themes/dynamik/css/images/donateposter_hover.jpg);
}
None of the background images are actually visible.
In Chrome Developer Tools, Under Computed Style, these two spans do appear to have a background image. If I copy and paste the URL of this image, I see the image. Yet nothing is actually rendering.
[UPDATE - this part is solved, thanks] In Chrome Developer Tools, under Matched Rules, only the #starthere
and #donate
spans are actually picking up the background-image
attribute. The #primarydocs
span is not. Why not?
SPAN
is an inline element. Which will indeed ignore such things. Try setting the display mode in your CSS to something like: display: block;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With