Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS HTML/Body Height should be 100% by default. #66

Closed
beaufortfrancois opened this issue Jan 31, 2014 · 4 comments
Closed

CSS HTML/Body Height should be 100% by default. #66

beaufortfrancois opened this issue Jan 31, 2014 · 4 comments

Comments

@beaufortfrancois
Copy link
Contributor

Hey guys, I've noticed that the HTML/BODY CSS Height was not consistent between the mobile chrome apps webview and chrome.

Here's the source of the simple app file:

<html>
<style>
  body {
    border: 2px solid pink;
  }
</style>
<body>
  <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem ....</p>
</body>
</html>

This screenshot is the file loaded by Google Chrome for Android:
screenshot_2014-01-31-13-12-09

This one is the same file loaded inside a mobile chrome app:
screenshot_2014-01-31-13-12-22

The trick/tip is to set this CSS:

<style>
  html {
    height: 100%;
  }
  body {
    border: 2px solid pink;
    height: 100%;
  }
</style>

I don't think this is good though.
What are your thoughts on that?

@mmocny
Copy link
Member

mmocny commented Jan 31, 2014

Hello François! Preparing to write up a G+ post? ;) We look forward to it.

CCA provides a default stylesheet to try and emulate the desktop chrome app styles:
https://github.com/MobileChromeApps/chrome-cordova/blob/master/plugins/chrome-bootstrap/www/chromeappstyles.css

It is based on: https://code.google.com/p/chromium/codesearch#chromium/src/chrome/renderer/resources/extensions/platform_app.css

Ours has fallen out of date, so I will update it to the latest version. Still, it appears that the platform_app.css will not supply a default body height of 100%. I'll investigate to see where that style is actually coming from on the desktop platform.

Note: we do not attempt to override the default user agent styles to make the webview more like chrome. There is another issue (#8) already open to provide a default css reset, so clearly this is something users want.

@beaufortfrancois
Copy link
Contributor Author

Hey Michal,

Yes, I was about and wanted to convert a simple Chrome App to Android but stumbled upon #62 sadly ;) I guess I'll have to wait a little bit more for this one.

Regarding this issue, it's not just about the <body> but also the <html>:

html,  body {
  height: 100%;
}

I actually thought user agent styles would be the same for desktop and mobile chrome apps. Doesn't it make sense?
Having the same rendering logic in Chrome wherever it runs on mobile or desktop?

@agrieve
Copy link
Member

agrieve commented Jan 31, 2014

Yeah, I think it makes sense to add what user-agent CSS differences that we can. This certainly seems like a big one.

@mmocny
Copy link
Member

mmocny commented Feb 4, 2014

@beaufortfrancois has just discovered that the root cause was a missing <!DOCTYPE html> from his application, which was causing the height 100% in desktop chrome. This is either a bug with apps on desktop, or at least a quirk we don't need to emulate.

Most app developers must add the style themselves. Closing this as wontfix.

@mmocny mmocny closed this as completed Feb 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants