Solved

Detect the width

Posted on 2003-10-24
6
157 Views
Last Modified: 2010-04-09
Dear All,
I got table displayed 100% of the client screen.
inside that table i have small tables (around 100 table ) , I want to automatically dedect the width of the big table to decide how many small tables i should display it per row.
Thanks.
0
Comment
Question by:ethar1
  • 3
  • 3
6 Comments
 
LVL 31

Accepted Solution

by:
seanpowell earned 250 total points
ID: 9616267
Well, one way would be to put the tables into div's with the float:left attribute. That way the tables will drop to the next level when they run out of room...


<table border="1" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td width="100%">
    <div style="float:left; width:100;">
    <table border="1" cellpadding="0" cellspacing="0" width="100">
      <tr>
        <td width="100%">&nbsp;</td>
      </tr>
    </table>
    </div>
    <div style="float:left; width:100;">
    <table border="1" cellpadding="0" cellspacing="0" width="100">
      <tr>
        <td width="100%">&nbsp;</td>
      </tr>
    </table>
    </div>
    <div style="float:left; width:100;">
    <table border="1" cellpadding="0" cellspacing="0" width="100">
      <tr>
        <td width="100%">&nbsp;</td>
      </tr>
    </table>
    </div>
    <div style="float:left; width:100;">
    <table border="1" cellpadding="0" cellspacing="0" width="100">
      <tr>
        <td width="100%">&nbsp;</td>
      </tr>
    </table>
    </div>
    <div style="float:left; width:100;">
    <table border="1" cellpadding="0" cellspacing="0" width="100">
      <tr>
        <td width="100%">&nbsp;</td>
      </tr>
    </table>
    </div>
    <div style="float:left; width:100;">
    <table border="1" cellpadding="0" cellspacing="0" width="100">
      <tr>
        <td width="100%">&nbsp;</td>
      </tr>
    </table>
    </div>
    <div style="float:left; width:100;">
    <table border="1" cellpadding="0" cellspacing="0" width="100">
      <tr>
        <td width="100%">&nbsp;</td>
      </tr>
    </table>
    </div>
    <div style="float:left; width:100;">
    <table border="1" cellpadding="0" cellspacing="0" width="100">
      <tr>
        <td width="100%">&nbsp;</td>
      </tr>
    </table>
    </div>            
    </td>
  </tr>
</table>
0
 

Author Comment

by:ethar1
ID: 9616375
Thanks  georgemarian for you great and prompt help :)
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 9616417
You're welcome, and thanks for the A :-)
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ethar1
ID: 9617063
georgemarian, can  you please tell me how lead a space between div and another?
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 9617094
If you mean how to "leave" a space between two div's, like this:

    <div style="float:left; width:100px; margin-right:10px;">
    <table border="1" cellpadding="0" cellspacing="0" width="100">
      <tr>
        <td width="100%">&nbsp;</td>
      </tr>
    </table>
    </div>
    <div style="float:left; width:100px; margin-right:10px;">
    <table border="1" cellpadding="0" cellspacing="0" width="100">
      <tr>
        <td width="100%">&nbsp;</td>
      </tr>
    </table>
    </div>

So, each div will have a 10 pixel margin on the right. Depending on how you want it spaced, you have a number of options:

Margin's all around:
<div style="float:left; width:100px; margin:10px;">

Only on both sides:
<div style="float:left; width:100px; margin-left:10px; margin-right:10px;">

Just on the top:
<div style="float:left; width:100px; margin-top:10px;">

etc...

Let me know if that helps you.
0
 

Author Comment

by:ethar1
ID: 9618877
YES, It helps me so so much.
Thanks man
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
send email part1 9 39
html / css issue / div issue. stuck, help needed 2 23
How to escape unsafe HTML tags 4 36
HTML or/and CSS codes to construct numbered paragraphs. 5 20
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question