Solved

Detect the width

Posted on 2003-10-24
6
154 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

896 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now