Loading ...
Sorry, an error occurred while loading the content.

6143Re: [NH] How do I centre?

Expand Messages
  • dhays@haysdesign.com
    Oct 2, 2007
    • 0 Attachment
      I sometimes use a percentage, such as:

      .centereddata {
      margin: 0 10% 0 10%;

      <div class="centereddata">Some stuff</div>

      (Change the 10% to anything you want.)

      And, if you want everything inside the DIV centered...

      .centereddata {
      margin: 0 10% 0 10%;
      text-align: center;

      Now you have a fluid, centered DIV. As the browser expands or contracts,
      the DIV does, as well.

      Is this what you mean?


      Photo News Today

      On Tue, 02 Oct 2007 16:48:34 +0200, Axel Berger <Axel-Berger@...>
      > Don, Loro, thanks for your input
      > "Don - HtmlFixIt.com" wrote:
      >> use auto for the left and right margin
      >> and that will center something horizontally.
      > Yes, if there are margins. But not if the entity, say a DIV, spreads out
      > to fill all the horizontal space as everything in HTML does by default.
      > loro wrote:
      >> So what is the content and what decides its "natural" width?
      >> Paragraphs suggest the content is text, but what's the width of
      >> some text? The width of the longest line or of the longest word?
      > Exactly. Of course this only makes sense for short headers and lines
      > broken with <BR>.
      >> I'd either use a width, it needn't be fixed
    • Show all 7 messages in this topic