• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

My JSP page won't center!

 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have been having a problem with getting a gridPanel to center in the middle of my page (BTW, I'm using Java Studio Creator to generate the page). It will center horizontally just fine by setting text-align: center, but the vertical-align: middle has no effect.

Looking at my generated jsp file, I see the following:

[code]
<h:form binding="#{Login.form1}" id="form1">
<h:panelGrid binding="#{Login.mainGridPanel}" cellpadding="10" id="mainGridPanel"
style="width: 100%; vertical-align: middle; font-size: 12px; text-align: center;" styleClass="">
<h:panelGrid binding="#{Login.titleGridPanel}" id="titleGridPanel">
[code]

Notice the styleClass="". Might this be causing some sort of problem?

Is there something "special" that needs to be done to get a gridPanel to center and would a blank ( styleClass="") cause any problems?

Thanks!

[eric - disabled smiles...]
[ April 05, 2005: Message edited by: Eric Pascarello ]
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
vertical align is for table cells, there is nothing like it for the entire page...

Eric
 
Darrin Smith
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks...but how do you get a gridPanel to center then?
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since there is no attribute for it is is rather messy:

http://www.jakpsatweb.cz/css/css-vertical-center-solution.html
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OR

make a table and use the vertical align property of the cell.

Eric
 
Darrin Smith
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Eric.

Originally posted by Eric Pascarello:
OR

make a table and use the vertical align property of the cell.

Eric

 
Darrin Smith
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm...I must not have understood.

Shouldn't adding a table to the page, then placing the grid inside of the table, and then setting the table as vertical-align: middle work?

This didn't seem to do it:

<body>
<h:form binding="#{Login.form1}" id="form1">
<h ataTable binding="#{Login.dataTable1}" headerClass="list-header" id="dataTable1" rowClasses="list-row-even,list-row-odd" rows="1"
style="vertical-align: middle" styleClass="" value="#{Login.dataTable1Model}" var="currentRow">
<h:column binding="#{Login.MyWebColumn1}" id="MyWebColumn1">
<f:facet name="header"/>
<h :p anelGrid binding="#{Login.mainGridPanel}" cellpadding="10" id="mainGridPanel" style="font-size: 12px; text-align: center; vertical-align: middle; width: 100%">
<h :p anelGrid binding="#{Login.titleGridPanel}" id="titleGridPanel">
<h utputText binding="#{Login.MywebLoginText}" id="MywebLoginText"
style="font-family: 'Arial','Helvetica',sans-serif; font-size: 18px" value="MyWeb Log

Originally posted by Darrin Smith:
Thanks Eric.


[ April 05, 2005: Message edited by: Darrin Smith ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic