PDA

View Full Version : divs too wide in EI7



JoshuaJonah
December 12th, 2007, 01:03 PM
workin on a little site, an html versiojn of one i did for SEO reasons:

http://www.lowbackclinic.com/testimonials.php

Look at the testimonials in firefox etc. they look fine, but in IE7 they are stretched over to the left side of the page. Tried everything i could think of, still not working. heres the source:



<?php
function nls2p($str){
return str_replace('<p></p>', '', '<p>'
. preg_replace('#([\r\n]\s*?[\r\n]){2,}#', '</p>$0<p>', $str)
. '</p>');
}
if (!($fp=@fopen("testimonials.xml", "r"))){die ("Couldn't open XML.");}
$usercount=0;
$userdata=array();
$content=array();
$state='';
if (!($xml_parser = xml_parser_create())){
die("Couldn't create parser.");
}
function startElementHandler ($parser,$name,$attrib){
global $usercount;
global $userdata;
global $state;
$state=$name;
}

function endElementHandler ($parser,$name){
global $usercount;
global $userdata;
global $state;
$state='';
if($name=="HOVERCAP") {
$usercount++;
}
}
function characterDataHandler ($parser, $data) {
global $usercount;
global $userdata;
global $content;
global $state;
if (!$state) {return;}
if ($state=="NAME") { $userdata[$usercount]["name"] = $data;}
if ($state=="CONTENT") { $content[$usercount] .= nls2p($data);}
if ($state=="IMAGE") { $userdata[$usercount]["image"] = $data;}
if ($state=="AUDIO") { $userdata[$usercount]["audio"] = "audio/".$data;}

}
xml_set_element_handler($xml_parser,"startElementHandler","endElementHandler");
xml_set_character_data_handler( $xml_parser, "characterDataHandler");
while( $data = fread($fp, 4096)){
if(!xml_parse($xml_parser, $data, feof($fp))) {
break;
}
}
xml_parser_free($xml_parser);
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Low Back Clinic - Testimonials</title>
<meta name="keywords" content="www.unikron.com, web, design, flash, video, streaming, production, new, media, html, php, asp, sql, interactive, internet">
<meta name="description" content="Spinal decompression therapy, Low Back Clinic, Toronto.">
<meta name="author" content="Unikron Inc - www.unikron.com">
<meta name="robots" content="all">
<meta name="copyright" content="Low Back Clinic - 2007">
<meta name="content-language" content="eng">
<meta name="revisit" content="5 days">

<link rel="icon" type="image/png" href="http://www.lowbackclinic.com/favicon.png">

<link rel="stylesheet" type="text/css" href="css/2col.css">

<script type="text/javascript" src="js/mootools.js"></script>
</head>

<body>
<div id="header"><img src="images/logoHeader.jpg" alt="Low Back Clinic"></div>
<div class="spacer">&nbsp;</div>
<div id="nav">
<ul id="navlist">
<li><a href="home.html" id="home" name="home" title="Go to Home Page" style="text-decoration:none; color:#ffffff;">Home</a></li>
<li><a href="about.html" id="about" name="about" title="Go to About Us" style="text-decoration:none; color:#ffffff;">About Us</a></li>
<li><a href="abouttreatment.html" id="abouttreatment" name="abouttreatment" title="Go to About the Treatment" style="text-decoration:none; color:#ffffff;">About the Treatment</a></li>
<li class="selected">Testimonials</li>
<li><a href="faq.html" id="faq" name="faq" title="Go to the F.A.Q" style="text-decoration:none; color:#ffffff;">F.A.Q.s</a></li>
<li><a href="form/index.html" id="apply" name="apply" title="Go to Treatment Application" target="_blank" style="text-decoration:none; color:#ffffff;">Apply for Treatment</a></li>
<li><a href="contact.html" id="contact" name="contact" title="Go to Contact Us" style="text-decoration:none; color:#ffffff;">Contact Us</a></li>
</ul>
<script type="text/javascript">
var alt = 1;
var menuitems = document.getElementsByTagName("li");
for(x in menuitems){

var myFx = new Fx.Style(menuitems[x], 'opacity').start(0,1);
var menulinks = menuitems[x].getElementsByTagName("a");
menuitems[x].menulinks = menulinks[0];
menuitems[x].style.cursor='pointer';
if(menuitems[x].innerHTML != "Testimonials"){
menuitems[x].onmouseover=function(){
this.style.backgroundImage = "url(images/menu-items-over.gif)"
}
menuitems[x].onmouseout=function(){
this.style.backgroundImage = "url(images/menu-items.gif)"
}
menuitems[x].onclick = function(){
window.location.href = this.menulinks.href;
}
}
}
</script>
</div>
<div id="content">
<?php
for ($i=0;$i<$usercount; $i++) {
echo "<div style='padding:10px; background-image:url(images/bglight.gif); border:1px solid #cccccc;'>";
echo "<div style='float:right;'><img src='images/".$userdata[$i]['image']."' /></div>";
echo "<span class='subtitle bluetext'>".$userdata[$i]['name']."</span><br>";
if($content[$i] != ""){echo $content[$i];}
if($userdata[$i]['audio']!=""){echo "<a href='".$userdata[$i]['audio']."' style='color:#ffffff'>This user has submitted an audio testimonial, click here to listen</a>";}
echo "<div style='clear:both'></div>";
echo "</div><br>";
}
?>
</div>
<div class="spacer">&nbsp;</div>
<div id="footer">Site designed by Unikron Inc.</div>
</body>
</html>

DDD
December 12th, 2007, 02:29 PM
I am not 100% sure what the problem is with your existing code. But floats can be problematic what I have done with a similar layout with a similar issue. Was wrap my layout in "wrapper" div. The position that div relative to the window where I need it. Assign it 100% width as needed. The absolute position my nav left and absolute my content right. Then give the content a margin-left slightly higher than the width of the nav. That will simulate the float you are after as well as get rid of the margin conflict you have there. I am almost sure it is a margin/padding conflict. Another thing you can do is go in and change all paddings and margins to zero and add them back one at a time. That got irritating for me which is why I went another route than a float.

Sorry if that didnt immediately answer your question as you wanted it.

JoshuaJonah
December 12th, 2007, 02:37 PM
no problem dude, thanx for the help threeD/Nate

JoshuaJonah
December 12th, 2007, 04:58 PM
ok, ive been toying with this and wondering why the others dont do it, only the divs with now body, weird.

JoshuaJonah
December 14th, 2007, 09:37 AM
Still no resolution, any help? BUMP

JoshuaJonah
December 14th, 2007, 10:34 AM
nevermind, resolved

biznuge
December 14th, 2007, 10:53 AM
formatting it like this seems to work, both in IE 6 & 7.

took out all your <br> tags too, cos i hate them... =)


<div style='padding:10px; background-image:url(images/bglight.gif); border:1px solid #cccccc; '>

<img src='http://www.lowbackclinic.com/images/Gary-Newitt.jpg' style='display:inline; height:1%; position:relative; float:right; ' />

<div style="position:relative; float:left;">
<span class='subtitle bluetext' >Gary Newitt</span>
<br />
<a href='audio/Gary Newitt_128K' style='color:#ffffff'>This user has submitted an audio testimonial, click here to listen</a>
</div>

<div style='clear:right'></div>

</div>


Hope this helps mate. :q:

Thik it had something to do with the main block not having "haslayout" maybe, as all the elements inside it were "a" or "span" and the image was outside normal flow with position:relative.

DDD
December 14th, 2007, 10:56 AM
You should share what the remedy was as I have had this problem too and just ended up recoding the layout to not use floats.

biznuge
December 14th, 2007, 11:25 AM
to be honest man, I'm not sure. just kinda messed with it for quarter of an hour.

think it's smoething to with the containing div not knowing what the hell it's dimensions are until the poaragraph clears the image, and then gives it a definative width, meaning it then has "haslayout" in IE.

putting all the text into a div gives it block level i think...

I think....

This may be a crock of an explanation, but, if so, just call it a black box that works, and use it.:+)

hope my tinkering helped anyway.


had staff party this lunch time, so my brain may not be fuctioning on as high a level as i'sd like with explanation,.

DDD
December 14th, 2007, 01:30 PM
I was talkin to JJ, he seemed to resolve the issue prior to your post.

biznuge
December 14th, 2007, 03:45 PM
ha ha.

that's posting after the pub for you....:wt: