Hey,
S40 devices don't support display orientation switching, so you don't need to worry about runtime resolution changes.
You can set the CSS file used by the app by detecting the screen width/height at app startup and by injecting a CSS file to the html head:
E.g. this works:
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>css.test</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript">
if (screen.width > 240) {
document.write('<link rel="stylesheet" href="landscape.css" type="text/css" />');
}
else {
document.write('<link rel="stylesheet" href="portrait.css" type="text/css" />');
}
</script>
</head>
<body >
hi there!
</body>
</html>
CSS files or new inline styles can't be injected or created during app runtime, but you can still dynamically apply pre-declared styles during runtime using e.g. mwl.addClass / removeClass / switchClass, etc. Documented here: http://www.developer.nokia.com/dp?ur..._API_Reference
petro