Home >Web Front-end >HTML Tutorial >The width of width:1050px is actually different under Chrome, Firefox and IE? _html/css_WEB-ITnose

The width of width:1050px is actually different under Chrome, Firefox and IE? _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:41:291530browse

On the same machine, with just one width setting, the widths displayed in three browsers are actually different. IE8 is the longest, followed by Firefox.
Because we need to put a picture, the size of the picture is 1050px. The effect is best under Chrome. Due to zooming in other browsers, the effect is not very clear.
How to solve it?

  <div style="width:1050px;height:30px;background-color: blue"></div>


Reply to the discussion (solution)

All assignments such as margin padding border and the like are set to 0

Then it will be compatible with the browser.

Correct answer on the first floor, because each browser has a default attribute when parsing tags. Margin, padding and border are the most common. Assigning all values ​​to 0 can avoid problems.

will be different, some browsers will calculate the border into the width, and some will not.

Standing basic code. . . .

*{border:0;padding:0;margin:0;text-decoration:none;}

Newcomer, let’s go through the questions~ I’ve seen the fifth floor several times~ By the way, you seem to like that expression very much

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn