SitePoint Sponsor

User Tag List

Results 1 to 12 of 12

Thread: CSS centering

  1. #1
    SitePoint Addict
    Join Date
    Mar 2005
    Location
    Toronto
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CSS centering

    I have heard that the <center> tag will become deprecated in the upcoming xhtml version 2.0, or is it already deprecated? So I am not in favor of using this tag, however, I am having trouble finding a css alternative, could anyone lend a helping hand please and thanks.

  2. #2
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,426
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    For inline elements use
    Code:
    text-align: center
    For block level elements use
    Code:
    margin: auto

  3. #3
    Non-Member Egor's Avatar
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    7,305
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    On block containers of inline elements, use text align: center;. This will centre-align inline contents inside that block.

    Off Topic:


    Why do you care about XHTML 2, or any version of XHTML at all for that matter?

  4. #4
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,426
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Egor
    On containers of inline elements, use text align: center;. This will centre-align inline contents inside that block.

  5. #5
    Non-Member Egor's Avatar
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    7,305
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by stymiee

    Hey John, I had to edit my post like 20 times, so we share that smiley.

  6. #6
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kefeso
    or is it already deprecated?
    Yes, it has been deprecated since HTML 4.0, and it probably won't come back.
    Simon Pieters

  7. #7
    SitePoint Addict
    Join Date
    Mar 2005
    Location
    Toronto
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thx all! That's really helpful, I knew that text-align: center does it, but it never worked, cuz I was using a block element. Thx again!

    Quote Originally Posted by Egor
    Off Topic:


    Why do you care about XHTML 2, or any version of XHTML at all for that matter?
    Oh hehe, not so much as care about xhtml 2 but rather if the center element is deprecated or not. It's just that to my knowledge, it's always better to avoid deprecated elements in a design.

  8. #8
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,426
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by kefeso
    It's just that to my knowledge, it's always better to avoid deprecated elements in a design.
    That's a good rule of thumb to live by.

  9. #9
    SitePoint Addict
    Join Date
    Mar 2005
    Location
    Toronto
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by stymiee
    That's a good rule of thumb to live by.
    Haha, yea, even though I don't really understand the meaning of deprecated elements. I only know that they are outdated and aren't recommended to be used for the new parsers but yet will still be parsed. Anyone care to explain a little further for me please

  10. #10
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,426
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    Eventually they will go away. And sooner then you might think. Small devices with limited memory and cpu power will run browsers that are slimmed down cousins of the desktop browser. They'll be the first to drop support for things like font tags to make their embedded browsers leaner and more efficient.

  11. #11
    SitePoint Addict
    Join Date
    Mar 2005
    Location
    Toronto
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm that makes sense, so now basicly they are trying to make xhtml a script of pure content and no presentation? and without css, a piece of xhtml is basically nothing but text and image scattered in a linear fashion?

  12. #12
    ~unplugged Ainslie X11's Avatar
    Join Date
    Feb 2005
    Location
    Langley, Virginia
    Posts
    1,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by zcorpan
    Yes, it has been deprecated since HTML 4.0, and it probably won't come back.
    which means it's safe to use for IE


    working hard is hard work


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •