Solved

positioning

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Responsive CSS question 2 42
Open a div with click on an image 7 48
razorCMS: Change Menu Font 4 27
modify h2 4 19
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
This article discusses how to create an extensible mechanism for linked drop downs.
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…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

747 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

12 Experts available now in Live!

Get 1:1 Help Now