Reply to Re: image alignment and Safari

Your name:

Reply:


Posted by Ben C on 05/01/07 07:31

On 2007-05-01, Ron <nomail@cox.net> wrote:
> Hi all,
>
> I'm in need of an opinion. The code following is meant to have an
> image on the left and to the right of it a header and then a new
> paragraph and some info that should run down the right of the image.
> It does this fine in IE, then wraps underneath, but in Safari after
> the H3 the new paragraph starts under the image. Not a huge deal but
> wondering of others have experienced this.

In standards-conforming browers <img align=left> is equivalent to <img
style="float: left">.

This means that text in the <p> following should go to the right of the
<img>, but only if there is enough room for it to go there without
overflowing.

But in quirks mode, align=left may be treated differently.

It's also possible that the difference is just due to differences in
font size, so that in IE the text happens to fit and in Safari it
doesn't.

Use the strict doctype:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">

and use 'style="float: left"' rather than "align=left". This won't solve
your problem but hopefully it will make results more consistent.

Then if you want the <p> to the right of the <img>, the best thing is
probably just to make sure there's likely to be enough room for the
text, but it's hard to say without seeing more of your markup.

> Thoughts on a better
> layout? Could easily use a table.
>
> for ($i=0; $i <$num_results; $i++)
> {
> $row = mysql_fetch_array($result);
> echo "<h3>";
> echo "<img align=left src=";
> echo $row["icon_url"];
> echo ">";
> echo $row["name"];
> echo "</h3>";
> echo "<p>";
> echo $row["address"];
> echo "<br>";
> echo $row["city"];
> echo ", ";
> And so on.......
>
> Thanks for any help.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация