The center element is deprecated

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kenny
    Confirmed User
    • Mar 2002
    • 7245

    #1

    The center element is deprecated

    The <center> tag is supported in all major browsers. However, it is deprecated and should be avoided!


    http://www.w3schools.com/TAGS/tag_center.asp


    Is there a good reason for this? Why is it suppose to be better to replace <center> with this mess"

    #centered{
    width: 800px; /* set to desired width in px or percent */
    text-align: left; /* optionally you could use "justified" */
    border: 0px; /* Changing this value will add lines around the centered area */
    padding: 0;
    margin: 0 auto;
    }
    7
  • PornMD
    Mainstream Businessman
    • Jan 2007
    • 9291

    #2
    Originally posted by kenny
    The <center> tag is supported in all major browsers. However, it is deprecated and should be avoided!


    http://www.w3schools.com/TAGS/tag_center.asp


    Is there a good reason for this? Why is it suppose to be better to replace <center> with this mess"

    #centered{
    width: 800px; /* set to desired width in px or percent */
    text-align: left; /* optionally you could use "justified" */
    border: 0px; /* Changing this value will add lines around the centered area */
    padding: 0;
    margin: 0 auto;
    }
    Yea, I have to admit it seems pretty lame. I have been using divs to do it and it seems to satisfy XHTML, but still I know I'm not doing it fully right.
    Want to crush it in mainstream with Facebook ads? Hit me up.

    Comment

    • rowan
      Too lazy to set a custom title
      • Mar 2002
      • 17393

      #3
      <center> is probably my favourite tag, right after <td> :D I'm going to hell.

      Comment

      • sysk
        Confirmed User
        • Aug 2007
        • 1005

        #4
        icq: 612510168 / email: [email protected] / php ninja 4 hire

        Comment

        • 420
          cuck
          • Mar 2003
          • 11571

          #5
          i wish i was cool <br><br><br><br><br><br>
          <!--BEGIN SIMUTRONICS PLAY BUTTON CODE -->
          <p align="center">

          <a href="http://buddy.play.net/dr?TMOREAU1">

          <img src="drplay.gif" width="128" height="64" alt="Play DragonRealms!"></a></p>

          <!--END SIMUTRONICS PLAY BUTTON CODE -->

          Comment

          • MetaMan
            I AM WEB 2.0
            • Jan 2003
            • 28682

            #6
            Everything on a page should be controlled by a parent element, why would you center the element outside of the stylesheet when you are already giving it properties?

            you are defeating the point of the CSS then.

            Comment

            • seeandsee
              Check SIG!
              • Mar 2006
              • 50945

              #7
              CSS eats my shit
              BUY MY SIG - 50$/Year

              Contact here

              Comment

              • kenny
                Confirmed User
                • Mar 2002
                • 7245

                #8
                Originally posted by MetaMan
                Everything on a page should be controlled by a parent element, why would you center the element outside of the stylesheet when you are already giving it properties?

                you are defeating the point of the CSS then.

                In this case it appears CSS is defeating it's self.

                If I want to center the entire webpage I fail to see how any tool can be more effective than the <CENTER> tag.

                CSS is soppose to make the job easier not harder
                7

                Comment

                • kenny
                  Confirmed User
                  • Mar 2002
                  • 7245

                  #9
                  Originally posted by sysk

                  So its not breaking news.. I must of missed that months issue of Geek Magazine

                  Fuck off with that dumb time line shit

                  Did somebody beat me to this topic? Can you point out a duplicate thread?
                  7

                  Comment

                  • TheDoc
                    Too lazy to set a custom title
                    • Jul 2001
                    • 13827

                    #10
                    This is what I use... it's compliant, and it works without question.
                    Code:
                    <div align="center">wrap/words</div>
                    Works great when everything else is left but you need a block of text centered.
                    Code:
                    <p align="center">words</p>
                    ~TheDoc - ICQ7765825
                    It's all disambiguation

                    Comment

                    • fris
                      I have to go potty
                      • Aug 2002
                      • 55785

                      #11
                      http://buildinternet.com/2008/11/how...site-with-css/
                      Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


                      Totally Free Templates

                      Comment

                      • kenny
                        Confirmed User
                        • Mar 2002
                        • 7245

                        #12
                        Yes, I know there are ways to do this using CSS

                        my point is that <center> did all of this without a block of code
                        7

                        Comment

                        • kenny
                          Confirmed User
                          • Mar 2002
                          • 7245

                          #13
                          Originally posted by TheDoc
                          This is what I use... it's compliant, and it works without question.
                          Code:
                          <div align="center">wrap/words</div>
                          Works great when everything else is left but you need a block of text centered.
                          Code:
                          <p align="center">words</p>
                          you're not suppose to do that now either

                          don't quote me but I'm pretty sure
                          7

                          Comment

                          • kenny
                            Confirmed User
                            • Mar 2002
                            • 7245

                            #14
                            Originally posted by TheDoc
                            This is what I use... it's compliant, and it works without question.
                            Code:
                            <div align="center">wrap/words</div>
                            Works great when everything else is left but you need a block of text centered.
                            Code:
                            <p align="center">words</p>
                            http://www.w3schools.com/tags/att_div_align.asp

                            Compatibility Notes

                            The align attribute of the div element was deprecated in HTML 4.01 and is not supported in XHTML 1.0 Strict DTD.

                            Use CSS instead.

                            CSS syntax: <div style="text-align:center">


                            None if it centers the whole webpage anyway..
                            7

                            Comment

                            • TheDoc
                              Too lazy to set a custom title
                              • Jul 2001
                              • 13827

                              #15
                              Originally posted by kenny
                              http://www.w3schools.com/tags/att_div_align.asp

                              Compatibility Notes

                              The align attribute of the div element was deprecated in HTML 4.01 and is not supported in XHTML 1.0 Strict DTD.

                              Use CSS instead.

                              CSS syntax: <div style="text-align:center">


                              None if it centers the whole webpage anyway..


                              My example returns complaint... The div align=center centers a div, which centers the entire webpage. Using less html and css than any other method, that returns complaint.

                              It not returning complaint in xhtml strict, which I don't have anything that uses that, so I'm not really worried about it.

                              My example does use less bytes of data, it works in every browser - every time, and it returns complaint for me, every single time.
                              ~TheDoc - ICQ7765825
                              It's all disambiguation

                              Comment

                              • kenny
                                Confirmed User
                                • Mar 2002
                                • 7245

                                #16
                                Originally posted by TheDoc
                                My example returns complaint... The div align=center centers a div, which centers the entire webpage. Using less html and css than any other method, that returns complaint.

                                It not returning complaint in xhtml strict, which I don't have anything that uses that, so I'm not really worried about it.

                                My example does use less bytes of data, it works in every browser - every time, and it returns complaint for me, every single time.
                                I was just shooting for 100% compliance across the board.

                                Your way is simpler than other CSS methonds.. but come on.. <CENTER> hands down walks this dog
                                7

                                Comment

                                • TheDoc
                                  Too lazy to set a custom title
                                  • Jul 2001
                                  • 13827

                                  #17
                                  Originally posted by kenny
                                  I was just shooting for 100% compliance across the board.

                                  Your way is simpler than other CSS methonds.. but come on.. <CENTER> hands down walks this dog
                                  Object embeds aren't complaint either but it's better than using Javascript
                                  ~TheDoc - ICQ7765825
                                  It's all disambiguation

                                  Comment

                                  • donborno
                                    Confirmed User
                                    • Jan 2007
                                    • 374

                                    #18
                                    The idea of XHTML and CSS is to keep structured content seperately from design and layout (for various reasons), not to reduce the number of letters you have to type.

                                    Comment

                                    • Serge Litehead
                                      Confirmed User
                                      • Dec 2002
                                      • 5190

                                      #19
                                      whoa, last time i sow or used <center> was few good years back)

                                      regarding tables, recently done one paysite tour, sliced in div 100% valid - we had to reslice it all in tables because client's cms had <tr>s and <td>s hardcoded into system - how crazy is that))))

                                      iframe is no good too and default adobe's flash embed is not valid..

                                      its hard to switch when you're used to old methods of doing things, but most of time after changing it becomes much better and easier and sometimes result in more options what you can do.

                                      many do <div><div><div><div><div><div>.... find it crazy - call it transition from past century (tabled nesting), there is really no need to do such complex nesting to keep structure in tact. deep nesting is harder to maintain..

                                      Comment

                                      • TheDoc
                                        Too lazy to set a custom title
                                        • Jul 2001
                                        • 13827

                                        #20
                                        Originally posted by donborno
                                        The idea of XHTML and CSS is to keep structured content seperately from design and layout (for various reasons), not to reduce the number of letters you have to type.
                                        Creating ANYTHING is ALL about reducing the work and making it load/run faster. It doesn't make a difference if it's code, html or css..

                                        It speeds up production, reduces possible errors and repeating text/code, makes the css more usable across multi-websites, it makes it work better across browsers, which all together reduces the amount of bytes used at several points, which helps make everything snap load faster, with the browser having to complete less work.

                                        Having it this way doesn't mean you will make more sales... But when it's done this way across 100's of Websites, the group reduction makes a difference in my own costs. No different than reducing the sizes of my images or tiny gif's..
                                        Last edited by TheDoc; 06-06-2009, 10:23 AM.
                                        ~TheDoc - ICQ7765825
                                        It's all disambiguation

                                        Comment

                                        • Hentaikid
                                          Confirmed User
                                          • Nov 2002
                                          • 1250

                                          #21
                                          It's been deprecated for ages, but most browsers still respect it out of backwards compatibility... so knock yourself out...

                                          Comment

                                          Working...