You are here: Re: margin: auto - but only up to a point « HTML « IT news, forums, messages
Re: margin: auto - but only up to a point

Posted by Els on 11/15/07 17:24

Tim Streater wrote:

> In article <a9ed4$473c781e$40cba7a7$8194@NAXS.COM>,
> "Jonathan N. Little" <lws4art@centralva.net> wrote:
>
>> Tim Streater wrote:
>>> I have an element that I would like to be centred on the page, so I use:
>>>
>>> margin-left: auto;
>>> margin-right: auto;
>>>
>>> This is fine but under some conditions the element then expands to fill
>>> the whole width of the window (variable content).
>>>
>>> I would like to restrict its expansion to within (say) a few pixels of
>>> the sides of the window. Can I do this with CSS?
>>
>> width: 99%;
>
> This appears to *force* the element (a table) to occupy 99% of the
> width. I want to *limit* it to that.

max-width:99%;

(does not work in IE6)

> I have:
>
> table.outerbox
> {
> margin-left: auto;
> margin-right: auto;
> margin-top: 20px;
> border-width: 4px;
> border-color: black;
> border-style: solid;
> }
>
> and then:
>
> <table class="outerbox">
> rows, cols
> </table>

You could always wrap it inside a div, and give the div a left and
right padding.


--
Els http://locusmeus.com/

 

Navigation:

[Reply to this 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

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