0

Hi. Since my layout does not fit 1024 x 768 (it was designed for 1284), I created another css that would fit 1024 resolution.

However, I need to replace images with smaller size. It was only index, a few images.

I cannot reduce the image size with css because it would cut half the side.


Can css assign images?
for example, pure html
<img class="hover" src="images/photography.jpg" alt="">

May css assign this jpg for this class???

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by MidiMagic
0

Checker,

Can css assign images?

Yes, by using a background image. Something like this for example:

In your 1284 stylesheet:

.hover {
  width: 100px;
  height: 50px;
  background-image: url('images/photography_large.jpg');
  background-repeat: no-repeat;
  background-color: #999;
}
And in the 1024 stylesheet:
.hover {
  width: 50px;
  height: 25px;
  background-image: url('images/photography_small.jpg');
  background-repeat: no-repeat;
  background-color: #999;
}

You will also need to purge the <img> tag and apply the above directives to a suitable alternative. This may be a bit challenging depending on exactly how the image sits in the page. In the first instance try applying to the container from which you deleted the <img>.

Airshow

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.