Solved

Detect the width

Posted on 2003-10-24
6
153 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

758 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

22 Experts available now in Live!

Get 1:1 Help Now