Tuan Nguyen
Tuan Nguyen

Reputation:

iframe shifts 1 pixel to left on some browser sizes

i have code like, sorry i dont have the exact code now. but its valid.

<iframe src="..." borderframe="0" scrolling="no" width=728px" height="90px"></iframe>

the target is a html file that contains code for a banner. everything displays well. but when i resize browser or go to maximize. the content is shiftet to the left by 1 pixel. so the banner is displayed missing the first vertical 1px line. and only 727px is visible.

anyone has an idea?

thank you.

Upvotes: 1

Views: 2672

Answers (4)

constantine
constantine

Reputation:

solution: u can add 0.5px to width

Upvotes: 0

Ben Regenspan
Ben Regenspan

Reputation: 10548

I'm having the same issue. What it seems like is a kind of "rounding error" even though these were supposed to have been fixed in FF since 1.5? The key thing about this I think is that the IFRAME is within a DIV that is centered on the page. When the window size is less than that of the DIV, everything's fine. When the window size increases and the size is brought up to an even (or maybe odd) width, is when the border disappears.

Upvotes: 0

Tuan Nguyen
Tuan Nguyen

Reputation:

the code is put "plain" in a div container.

there is no percentage or relative width. :(

Upvotes: 0

Karl
Karl

Reputation: 9155

I have an idea, but you haven't given us the whole picture, so I might be way off.

I would guess that the iframe is positioned with a percentage or some sort of division calculation like 40% left of parent. Then at certain browser widths this number doesn divide evenly and gets truncated. Say it is at 100px in from the left side, and you shrink the parent by 2/3rds so that its positioning would become 66.66 pixels, and the browser cuts this off to 66, giving an apparent error of one pixel left.

Upvotes: 6

Related Questions