Reputation: 1611
I have an old but simple html/css page with a barcode, that is generated by an ASP script. The problem is the barcode has different appearence on Internet Explorer and Chrome. The html/css code is very simple, still I can't understand what is going on. Already tried some modifications, without sucess. :(
For generating the bar code I have 2 gif images:
And the HTML/CSS is simple as this:
<style type="text/css">
img.barcode {
border: 0;
padding: 0;
margin: 0;
}
</style>
<tr>
<td width="659" colspan="2" style="background-color:#FFFFFF;">
<img src="imagens/p.gif" class="barcode" style="width:1px;height:50px;"><img
src="images/b.gif" class="barcode" class="barcode" style="width:1px;height:50px;"><img
src="images/p.gif" class="barcode" style="width:1px;height:50px;"><img
src="images/b.gif" class="barcode" style="width:1px;height:50px;"><img
src="images/p.gif" class="barcode" style="width:1px;height:50px;"><img
src="imagens/b.gif" class="barcode" style="width:3px;height:50px;"><img
src="images/p.gif" class="barcode" style="width:3px;height:50px;"><img
...
src="imagens/b.gif" class="barcode" style="width:3px;height:50px;"><img
src="images/p.gif" class="barcode" style="width:3px;height:50px;"><img
src="imagens/b.gif" class="barcode" style="width:3px;height:50px;"><img
src="images/p.gif" class="barcode" style="width:1px;height:50px;"><img
src="imagens/b.gif" class="barcode" style="width:1px;height:50px;"><img
src="images/p.gif" class="barcode" style="width:3px;height:50px;"><img
src="images/b.gif" class="barcode" style="width:1px;height:50px;"><img
src="images/p.gif" class="barcode" style="width:1px;height:50px;">
</td>
</tr>
In Internet Explorer it works perfecty:
But in Google Chrome I have this:
Please, anyone knows what is going on and how to solve?
Thanks!!
Upvotes: 1
Views: 131
Reputation: 21685
FWIW, here's a CSS only approach using flexbox
.
.barcode {
display: flex;
}
.barcode > div {
width: 1px;
height: 50px;
background-color: black;
}
.barcode .lg {
width: 3px;
}
.barcode .invert {
background-color: white;
}
<div class="barcode">
<div></div>
<div class="invert"></div>
<div></div>
<div class="invert"></div>
<div class="lg"></div>
<div class="invert lg"></div>
<div></div>
<div class="invert"></div>
<div></div>
<div class="invert"></div>
<div></div>
<div class="invert"></div>
<div></div>
<div class="invert"></div>
<div class="lg"></div>
<div class="invert lg"></div>
<div></div>
<div class="invert"></div>
<div></div>
<div class="invert"></div>
<div></div>
<div class="invert"></div>
<div class="lg"></div>
<div class="invert lg"></div>
<div></div>
<div class="invert"></div>
<div></div>
<div class="invert lg"></div>
<div class="lg"></div>
<div class="invert"></div>
<div></div>
</div>
Every DIV is a bar. Then just define if the bar needs to be "inverted" (white) and/or thicker.
Upvotes: 0
Reputation: 496
Chrome is displaying the "Image not found" image, while IE doesn't show anything. Your b.gif
is not in imagens/
, it is in images/
Upvotes: 3
Reputation: 1426
Change your style to this:
<style type="text/css">
td {
font-size: 0; /* there would be no spacing when images are rendered. */
}
img.barcode {
border: 0;
padding: 0;
margin: 0;
display: inline-block; /* Chrome default is inline */
vertical-align: top; /* ensure that all images stand at the top. */
}
</style>
Upvotes: 0