On Mon, Dec 26, 2011 at 9:27 PM, Aaron Gray <[email protected]> wrote:
> Is there another way with HTML 4.01 strict to vertically and horizontally
> centre an <img> within a page other than boxing it by <div>'s and turning
> them into 'display: table' and 'display:table-cell', and aligning them to
> center, middle ?
Hi Aaron. Use a table-based layout... well not really :D
.containing_element {
display: table-cell;
vertical-align: middle;
}
vertical-align only works on table cells and other elements that have
display:table-cell. Support is pretty good. It should be IE8+ and
all other major browsers.
I'd also recommend reading about anonymous table objects (
http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes ) that can be
created when you use display:table-cell. They can surprise you when
you're trying to line things up.
references:
http://www.quirksmode.org/css/display.html#t06
http://www.w3.org/TR/CSS21/visuren.html#propdef-display
http://www.w3.org/TR/CSS21/tables.html#table-display
http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes
>
> Many thanks in advance,
>
> Aaron
--
Ghodmode
http://www.ghodmode.com/blog
______________________________________________________________________
css-discuss [[email protected]]
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/