Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

actual/real size displayed on the screen

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how could I know a component <b>actual/real</b> size displayed on the screen.

for example, I have a table, I do not define the height,

<table id="table" height="" border="1">
<tr><td>dddddddd</td></tr>
<tr><td>dddddddd222</td></tr>
</table>

Then after it displayed, I want to know the real hight and width displayed on screen. My purpose is to handle resize issues.

Thanks.
 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Edward,

number of rows * height per row (or is that too simple?)

Herman
 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right, but how could I know the row's real height ?

Thanks
 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, you can set the row's height in your style sheet by setting the height of all "td"'s:

td{
line-height: 20px;
}

or if you only want to set height for "td"'s in a table with id="table"

table#table td{
line-height: 20px;
}

Herman
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic