Solved

positioning

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
html input 8 42
jQuery Dialog Autoresize Bug 2 25
Load data upon clicking a button 8 35
Non-Resizable Pharagraph 2 7
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
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 …

837 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