mosh
mosh

Reputation: 534

Cross-browser html and css - Internet Explorer and Chrome

I've got html+css code running and looking good on explorer 10.

When i open the page in chrome the only differnce is the resolution. Things (like headlines for examp.) that take 100% of the screen in explorer takes something like 75%-80% in chrome.

That causes white spaces to apper on the remaining 20%-25%.

is there any solution that doesn't require massive modifications in the code?

thanks.

*any code will demonsrate the issue, for examp:

<!DOCTYPE html>
<html>
<body>


<div >
This takes all the screen in explorer 10 but not in chrome.................................................................................................................................................................................................................................................................................
</div>


</body>
</html>

Upvotes: 0

Views: 131

Answers (2)

Afzaal Ahmad Zeeshan
Afzaal Ahmad Zeeshan

Reputation: 15860

That problem is because you are not providing any CSS code to the file!

When there is nothing to process, the browser adds its own style. Which are known as "User-agent stylesheet". Which have their own styling techniques.

To minimize this, you can add just a few of the codes such as:

body {
  margin: 0;
  padding: 0;
}

This way, you can minimize the browser's override to control and change the auto margin and auto padding techniques!

In Google Chrome, if you just create a simple file like the one you have. And run it after saving it, you will find that browser automatically adds

margin: 8px;

And some of the other styles to the document on its own! That is because of the browser's CSS sheet.

Upvotes: 1

Lochlan
Lochlan

Reputation: 2786

Use a "reset" CSS file. Here are some of the more popular ones: http://www.cssreset.com/

The problem here is that the "user agent stylesheet" is different between browsers, so a reset stylesheet will impose specific styles, thus making all browsers look approximately the same.

Upvotes: 1

Related Questions