Skip to content

Replacing images in img tags

JasonBarnabe edited this page Apr 28, 2012 · 2 revisions

While replacing background images is easy with CSS, replacing images created with <img> tags is not. You need to do the following trick to switch <img> tag images.

#your-selector-here {
	height: 0 !important;
	width: 0 !important;
	/* these numbers match the new image's dimensions */
	padding-left: 125px !important;
	padding-top: 25px !important;
	background: url(http://example.com/your/image/here) no-repeat !important;
}