Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-01-2006, 05:21 PM   PM User | #1
phpkid
New Coder

 
Join Date: Dec 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
phpkid is an unknown quantity at this point
Position:absolute inside Position:Relative

Hi guys, I posted this on the PHP forum and realized I asked in the wrong spot, Can you take a look? Thanks
PK
Quote:
Hey all, this is my first post in a long time... I've been a fan of this forum and hope you can all help me again like you have before. Here's my newest dilema.

I have a code. (relative code only)

PHP Code:
<link rel="stylesheet" href="index.css" type="text/css">
<table width="90%" border="0" cellpadding="0" cellspacing="0">
  <tr>
<?
$result 
mysql_query("SELECT * FROM coupons"); //Selects from database

if ($myrow mysql_fetch_array($result)) {
    do {
    
$C_ID $myrow["C_ID"];
    
$name $myrow["name"];
    
$desc $myrow["desc"];
    
$exp $myrow["exp"];

if (
$pos == 3){?></tr><tr><? $pos 1;}
$pos $pos+1
?>
    <td width="38%">
    <div align="center" style="position:relative"><img src="images1152x864/coupon.jpg" width="293" height="233" /><br />
    <div align="center" style="position:absolute; top:8px; left:6px; width: 285px;" class="header2"><? echo $name?></div>
    <div align="left" style="position:absolute; top:55px; left:10px; width: 180px; height: 110;" class="desc"><? echo $desc?></div>
    <div align="center" style="position:absolute; top:185px; left:25px; width: 100px; height: 30;" class="exp"><? echo 'Expires:<BR>'.$exp?></div>
    </div>
    </td>
<?
    
} while ($myrow mysql_fetch_array($result));    
}
?>
  </tr>
</table>
This works fine in IE... However in Firefox it does not... any ideas how I can get this to work on both?

Thanks

PK
phpkid is offline   Reply With Quote
Old 12-01-2006, 05:24 PM   PM User | #2
ahallicks
Senior Coder

 
ahallicks's Avatar
 
Join Date: May 2006
Location: Lancaster, UK
Posts: 1,134
Thanks: 1
Thanked 57 Times in 55 Posts
ahallicks is on a distinguished road
A link?
ahallicks is offline   Reply With Quote
Old 12-01-2006, 05:30 PM   PM User | #3
phpkid
New Coder

 
Join Date: Dec 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
phpkid is an unknown quantity at this point
I can't link to it, but basically, the absolute divs do not take to the relative container
phpkid is offline   Reply With Quote
Old 12-02-2006, 01:42 AM   PM User | #4
harbingerOTV
Senior Coder

 
Join Date: Jan 2005
Location: Memphis, TN
Posts: 1,765
Thanks: 8
Thanked 123 Times in 121 Posts
harbingerOTV will become famous soon enough
Code:
    <div align="center" style="position:relative;border:1px solid #000;">
<div style="position:relative;margin:0 auto;background:#ccc;width:293px;">
<img src="images1152x864/coupon.jpg" width="293" height="233" /><br />
    <div align="center" style="position:absolute; top:8px; left:6px; width: 285px;background:#fdd;" class="header2">1</div>
    <div align="left" style="position:absolute; top:55px; left:10px; width: 180px; height: 110px;background:#36f;;" class="desc">2</div>
    <div align="center" style="position:absolute; top:185px; left:25px; width: 100px; height: 30px;background:#d6c;" class="exp">3</div>
</div>
    </div>
IE will center anything. wrap all that stuff in another div and give it a width and aplpy margin: 0 auto and the oother browsers will play along.
__________________
Stop making things so hard on yourself.
i is tugbucket :: help raise tugburg :: Whitehaven Kiwanis
harbingerOTV is offline   Reply With Quote
Old 12-02-2006, 02:32 AM   PM User | #5
phpkid
New Coder

 
Join Date: Dec 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
phpkid is an unknown quantity at this point
Thank you very much. I would have never thought about adding another DIV

PK
phpkid is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:10 AM.


Advertisement
Log in to turn off these ads.