Previous Message
Next Message

Centering a div with an image

Sent by Gunlaug_Sørtun on 21 December 2007 10:10


Jan Erik Moström wrote:

> Of course there is one solution that seems to work fine:
> 
> <table> <tr><td> <div id="jem-photobackground"> [...]

> But I'm not sure if this is a good solution.

It was ... 10 years ago :-)

Wrapping elements in tables to achieve a "shrink to fit" effect, is
definitely not a good solution in 2007.

Try a suitable "shrink to fit" block formatting...
<http://www.w3.org/TR/CSS21/visuren.html#block-formatting>
....directly on the #jem-photobackground instead, and set those margins
directly on the same as 'margin: 0 auto'.

FWIW: your case is as clear as fog, so you'll only receive info on the
basics behind centering of elements with unknown dimensions unless you
provide a proper - live - example for what you're after - the actual case.

regards
	Georg
-- 
http://www.gunlaug.no
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: