Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

height tag is not working correctly in 'body' element.

 
sharath kumar reddy karnati
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Please find below script in written in HTML

<html>
<form>
<body height="500px;" style="background-color: yellow;" >
<table width="100%" border="1" cellpadding="0" cellspacing="0" style="background-color: #FFFFFF; border: 2 solid #0000C0">
<tr>
<td> first </td>
<td> second </td>
</tr>
<tr>
<td> three </td>
<td> four </td>
</tr>
</table>
</body>
</form>
</html>

When I run this HTML code it is dislaying yellow background in form and table is showing on top. When I do same thing in JSF with following code

<f:view>
<h:form>

<body style="height:500px" leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">

<center>
<h:panelGrid width="100%" columns="2" border="0" columnClasses ="column1,column2" >
<center>

<hutputText value="User Id:" />
<h:inputText id="userId" value="#{LoginValidation.loginname}" />


<hutputText value=" " />
<h:commandButton value="Login" action="#{LoginValidation.CheckValidUser}" />

<hutputText value="New User?" />
<h:commandLink value="Register Here" action="newuser" />

</center>
</h:panelGrid>
</center>
</body>
</h:form>
</f:view>

When I'm executing this script, it is not showing the hight which I mentioned in <body> tag, it is taking default height depending upon the values mentioned in <h:panelGrid>.

In case, if I give height in <h:panelGrid> then it is working fine.

Please help.

Thanks in advance.

Regards,
Sharath.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18214
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've got some seriously messed-up HTML/JSF there. You start with <html> but end with <f:view> and your form/f:form construct isn't any better. Also, the HTML body tag goes outside the form tags. In JSF, all the tags have to match up properly and be in their proper places. Actually, that's true in HTML as well, but web browsers are more likely not to complain about bad tags. Though they may display unreliably.

I'm not sure a body tag can have a height attribute, since the height of a web page body is whatever the user sizes the window to be.

When you set dimensions in web page components, they will tend to "stretch" their containing components, which appears to be what you're seeing.
[ July 30, 2007: Message edited by: Tim Holloway ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic