Solved

positioning

Posted on 2012-04-10
5
180 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

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!

Question has a verified solution.

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

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 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 style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

735 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