panel centered in screen

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

HarryDeBoer
Ebase User
Posts: 118
Joined: Tue Oct 23, 2012 7:01 am
Location: The Netherlands

panel centered in screen

#1

Postby HarryDeBoer » Thu May 01, 2014 8:48 am

Hi,

I want to start my application with a login panel in the center of the browser screen. What's the -easiest- way to do that?

Regards, Harry
0 x
Kind regards,

Harry

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Thu May 01, 2014 12:51 pm

There's more than one way to do this. One easy way is to set the layout of the root control (the Page Control) to Vertical Box then click Layout Properties and set both horizontal alignment properties to Center. If you don't have anything declaring a specific page width e.g. a body style, this should work OK.

Regards
Jon
0 x

HarryDeBoer
Ebase User
Posts: 118
Joined: Tue Oct 23, 2012 7:01 am
Location: The Netherlands

#3

Postby HarryDeBoer » Thu May 01, 2014 1:25 pm

Hi Jon,

I followed your instructions (new testform). The panel is horizontally aligned but not vertical! (so it's on top of the screen). I did a workaroud with an inline style that worked, but still wonder if this can't be done the 'layout' way.

Regards, Harry
0 x
Kind regards,

Harry

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#4

Postby Jon » Thu May 01, 2014 2:21 pm

Vertical alignment is harder because it needs an explicit height specification e.g. set up a Panel and give it a height of say 800px, then you can see that a vertical alignment of Center will work (tip: set a background colour so you can see what's happening). This works with an explicit height, but if you change this to a height of 100% it doesn't work; this is because 100% means 100% of the parent HTML element and so on back to the body tag. So without an explicit height set somewhere, it doesn't do anything. There may be a clever CSS way of setting the height to the current window height, but I don't know how to do this.

Regards
Jon
0 x

HarryDeBoer
Ebase User
Posts: 118
Joined: Tue Oct 23, 2012 7:01 am
Location: The Netherlands

#5

Postby HarryDeBoer » Fri May 02, 2014 11:34 am

Hi Jon,

this did the trick (panel is 400x400):

position:fixed;
z-index:100;
top:50%;
left:50%;
margin:-100px 0 0 -100px;
width:400px;
height:400px;
0 x
Kind regards,

Harry


Who is online

Users browsing this forum: No registered users and 7 guests