Solved

CSS and PHP - Image/text does not align properly in IE7, but does in FF/Opera/etc

Posted on 2009-04-01
3
594 Views
Last Modified: 2013-12-08
Okay, first things first, I'll include a image so you can see what I am talking about. This is an issue with CSS styles.

Basicly what is occuring is in IE7, the writing is being shifted over. I want it to look like the top example, where the 'FEATURED' 'hovers' just on the top left of the image and the wording is to the right of the thumbnail.

In other browsers, it seems to be just fine. I do have
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Declared.. I will post the featured coding however! Maybe someone can give me some advice. basicly this coding LOOPS to create the actual featured listing with thumbnail and wording, etc. but what I'm really looking at I suppose is the 'style' that is declared here twice, you will see it below!
foreach($data as $d){
 
 
    echo "<li style='float:left;width:280px;list-style:none;padding:10px;margin:10px'>
    			<a href='index.php?option=website&task=view_sale&id={$d[id]}'>
    			<div style='position:absolute;margin-left:-18px;margin-top:-9px'>
    				<img src='photos/featured.gif' alt='Featured' border=0>
    			</div>
    			<img align='left' src='http://open.thumbshots.org/image.pxf?url={$d[site_name]}' border=1 hspace=10 width=120 height=90></a>
    			<div style='position:absolute;margin-left:140px;margin-top:0px'>
    			<a href='index.php?option=website&task=view_sale&id=$d[id]'>$d[site_name]</a><br>
    			For {$d[price]}$<br>
				</div>
    	 </li>";
 
 if(++$n>=2) break;
}

Open in new window

issue.jpg
0
Comment
Question by:Valleriani
[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
3 Comments
 
LVL 3

Accepted Solution

by:
ecomm earned 500 total points
ID: 24046028
Hi,

Try the attached code, it should resolve the problem in IE and keep working in FireFox.

Spencer



foreach($data as $d){
 
 
    echo "<li style='float:left;position:relative;width:280px;list-style:none;padding:10px;margin:10px'>
                        <a href='index.php?option=website&task=view_sale&id={$d[id]}'>
                        <div style='position:absolute;left:0px;top:0px;'>
                                <img src='photos/featured.gif' alt='Featured' border=0>
                        </div>
                        <img align='left' src='http://open.thumbshots.org/image.pxf?url={$d[site_name]}' border=1 hspace=10 width=120 height=90></a>
                        <div style='position:absolute;top:10px;left:150px;'>
                        <a href='index.php?option=website&task=view_sale&id=$d[id]'>$d[site_name]</a><br>
                        For {$d[price]}$<br>
                                </div>
         </li>";
 
 if(++$n>=2) break;
}

Open in new window

0
 
LVL 13

Expert Comment

by:qwerty021600
ID: 24046431
Reduce the margin given for the text next to Yahoo and Google.
0
 
LVL 7

Author Closing Comment

by:Valleriani
ID: 31565566
Ahhhh damn, was the second div then, perfect! This worked great!
0

Featured Post

Independent Software Vendors: 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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to count occurrences of each item in an array.
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…

729 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