Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
yosoh
Posts: 213
Registered: ‎07-18-2008
My Device: Not Specified

playbook screen width and height

hi there,

 

may be it's a silly question but I am just beginning to learn web app development. As of now I am hardcoding my width and height of playbook in CSS sheet.

 

 

body {
	padding: 0;
	margin: 0;
	
    color: black;
    height:600;
    width:1024;
}

 Is it possible to set these things dynamically as size playbook size can change later ? any example thanks :smileyhappy:

 

--------------------------------------------------
problemSolved() ? kudosPlease():kudosPlease();
Developer
jmace
Posts: 482
Registered: ‎10-24-2008
My Device: 9300

Re: playbook screen width and height

 

body 
{ 
   padding: 0; 
   margin: 0; 
   color: black; 
   height:100%; 
   width:100%; 
}

 

Above is one way to handle it with CSS.

 

_________________________________________
www.jasonmace.com/blackberry
Developer
yosoh
Posts: 213
Registered: ‎07-18-2008
My Device: Not Specified

Re: playbook screen width and height

thanks for the reply, but that doesn't work too :smileysad:

--------------------------------------------------
problemSolved() ? kudosPlease():kudosPlease();
Developer
aserra
Posts: 63
Registered: ‎10-07-2009
My Device: Not Specified

Re: playbook screen width and height

are you try to specify the "px" ? I have:

 

<body><div class="wrapper"></div></body>

 

.wrapper { width: 1024px; height: 600px; }

 

and it work perfectly.

Developer
ryanmc
Posts: 71
Registered: ‎02-04-2011
My Device: Blackberry Bold & Pearl

Re: playbook screen width and height

Why are you putting a fixed size on your body tag? It will automatically size to the content provided, size the content to what you want and don't touch the body size.

 

 

Developer
yosoh
Posts: 213
Registered: ‎07-18-2008
My Device: Not Specified

Re: playbook screen width and height

well I know that it works perfectly when I specify width and height but my question was how can I  AVOID HARDCODING play book specific width and height.

 

thanks.

--------------------------------------------------
problemSolved() ? kudosPlease():kudosPlease();
Developer
ryanmc
Posts: 71
Registered: ‎02-04-2011
My Device: Blackberry Bold & Pearl

Re: playbook screen width and height

Its a hard question, and one that web developers have been fighting since we dropped table based layouts and whent to CSS. 

 

You have some parts of the interfaced fixed height and width and other parts designed to expand or contract depending on realestate available. Fortunately you only have to tailor your CSS to one platform, web kit, 

 

You can also detect the resolution using Javascript, by checking out the window.innerwidth and innerheight variables and say put a different class on the body tag to trigger different CSS depending on screen size.

 

you could have for instance:

 

#small .nav {

width:50px;

}

#med .nav {

width:100px;

}

#large .nav {

width:200px;

}

 

and set the body id of #small, #med, or #large depending on what window.innerwidth comes up with.

Developer
yosoh
Posts: 213
Registered: ‎07-18-2008
My Device: Not Specified

Re: playbook screen width and height

thanks ryanmc for the detailed reply,

 

I come from java development background for BB and gradually learning these web technologies, i will try your suggestion and ofcourse google :smileyhappy:

--------------------------------------------------
problemSolved() ? kudosPlease():kudosPlease();