Jump to content

Firefox/Safari headache with PHP/CSS


smujesse

Recommended Posts

I am trying to come up with a script that pulls info out of a database and displays it in a grid-like layout using div's. I have it working in IE just fine, but in Safari/Firefox it only lists the items down the left side of the page (100% width div's) as if the PHP is ignoring the CSS.

 

 

 

Here is the code:

 

PHP:

<?php
$k=0;
$getinfo = mysql_query("SELECT * from table");
      while($info = mysql_fetch_array($getinfo))
       {
	  echo ("<div class='infoclass'><a href='page.php?id=$info[id]'>$info[item]</a></div>");
	  $k++;
	  }
?>

CSS:

.infoclass {
width:64px;
height:64px;
float:left;
clear:none;
margin:1px;
padding:2px;
border:solid 1px #E10505;
}

 

I am in dire need of a solution/fix or any better method of getting this same effect.

Link to comment
Share on other sites

CSS has nothing to do with your php code since your CSS style works client side not serverside your browser never gets to see a single line of php code. Somehow your generated HTML goes wrong. Try to view the source of your browser to see what goes wrong. Your php code looks fine to me I think its the div that contains all the floating divs

Link to comment
Share on other sites

Thanks Dj,

I guess what I meant by PHP was the HTML syntax used within PHP for echo. Like you can't use

echo("<div class="class"></div>");

Is there a better way to display 64x64 boxes in a 8x8 grid? The floating div way worked for me in IE at one time but not in Safari/Firefox, which was different for me, usually the other way around!

 

(I know that this post is double posted, I cant figure out how to delete one!)

Link to comment
Share on other sites

using single quote or double quote doesn't really matter for CSS but if you want to know how to use double quote with php here is how to

echo("<div class=\"class\"></div>");

simply put slash infront of the double quote.

 

can you post your HTML source as shown in your browser I am 100% your goal can be reached with your approach it's prob just a CSS thing

Link to comment
Share on other sites

<div class='infoclass'><a href='page.php?id=34'>item</a></div>

 

I think I need to just spend more time making sure the CSS files are linked correctly? I wish there was a web-based HTML editor that you could enter in your FTP info so that I could mess with this at work!

 

 

After this I was planning to figure out a way that the order that the items are displayed can be changed by a drag and drop AJAX interface similar to how you edit your "top 8" in MySpace if that helps you understand what I am trying to get at.

So I am not sure if the floating div is the best way to go about this.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.