Solved

positioning

Posted on 2012-04-10
5
181 Views
Last Modified: 2012-04-19
Hi

I have two tables, placed side by side.

Problem: the positioning varies when I change screen resolution. how do i fix it? I have been trying to google but i could not find a solution.

try the following code with different screen resolutions.


<table border="1">
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>

<div style="position:absolute; top:1px; left:160px ">
<table border="1">
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
    
</div>
¿

Open in new window

0
Comment
Question by:genius_geek
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 38

Expert Comment

by:Tom Beck
ID: 37830777
It looks the same at every screen resolution in Firefox 11. The right table overlaps the left by about 15 pixels.

The only thing I could imagine that would change the appearance is increasing the text size thus increasing the space consumed by each cell. Table cells will expand as needed. Still, the right table will remain 160px left of the window edge but the overlap will increase as the cells get wider.
0
 
LVL 16

Accepted Solution

by:
HagayMandel earned 250 total points
ID: 37831076
This will do it:
<div id="left" style="float:left; width:50%;">
<table border="1">
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2 more content,  more content, more content, more content, more content, more content, more content, more content, more content, </td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
</div>
<div id="right" style="float:left; width:50%;">
<table border="1">
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2 more content,  more content, more content, more content, more content, more content, more content, more content, more content,</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>   
</div>

Open in new window

0
 
LVL 3

Assisted Solution

by:deegoy418
deegoy418 earned 250 total points
ID: 37859185
I found very minor issue, which I have fixed, now you can use this code...

<div style="width:100%; position:relative;">
<table border="1" style="width:50%; float:left;">
  <tr>
    <td>row 1, cell 1</td>
    <td>row 1, cell 2</td>
  </tr>
  <tr>
    <td>row 2, cell 1</td>
    <td>row 2, cell 2</td>
  </tr>
</table>
  <table border="1" style="width:50%; float:left;">
    <tr>
      <th>Header 1</th>
      <th>Header 2</th>
    </tr>
    <tr>
      <td>row 1, cell 1</td>
      <td>row 1, cell 2</td>
    </tr>
    <tr>
      <td>row 2, cell 1</td>
      <td>row 2, cell 2</td>
    </tr>
  </table>


</div>

Please let me know if still you have any problem regarding the position.
0
 
LVL 3

Expert Comment

by:deegoy418
ID: 37864158
Thanks tommyBoy
0
 
LVL 38

Expert Comment

by:Tom Beck
ID: 37865090
??
0

Featured Post

Industry Leaders: 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

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.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
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 learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

751 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