user3467273
user3467273

Reputation:

Image not shown properly in firefox

If the image is not available in the folder then browser only show img tag with its given height and width but firefox creates problem in this case..

Problem : I am using img attribute to show an image. In firefox it looks like i am using style="width: 180px; height: 185px;"

enter image description here

but in chrome it looks like

enter image description here

Upvotes: 1

Views: 286

Answers (2)

decho
decho

Reputation: 534

Try this:

@-moz-document url-prefix(http), url-prefix(file) {
    img:-moz-broken{
    -moz-force-broken-image-icon:1;
    width:180px;
    height:185px;
    border:1px solid #000;
    }
}

Example jsfiddle.

EDIT: The solution posted by Gaurav is better, use it instead.

-moz-force-broken-image-icon

The use of this property is not recommended. A proper alt attribute should be used instead.

Upvotes: 0

4dgaurav
4dgaurav

Reputation: 11506

Remove attribute alt="" it will work in Mozilla as well.

Demo

HTML

<img src="youImage.jpg" style="width: 180px; height: 185px;"/>

Mozilla

enter image description here

Chrome

enter image description here


If you wish to have alt as well **Demo **

Upvotes: 1

Related Questions