Home All Groups Group Topic Archive Search About

CSS substitution for the <center> tag

Author
16 Jan 2007 12:42 AM
Nathan Sokalski
As most of us probably know, the <center> tag is deprecated. Because many
elements and controls have an align attribute, centering them is easy
enough. However, certain elements/controls do not (such as the ASP.NET
Button and Label controls). For the ASP.NET label control I usually just add
the following attributes:

Width="100%" style="text-align:center;"

However, this does not work for controls such as the ASP.NET Button control.
The only solution I can think of is to nest it inside of <div
align="center"></div> tags. However, this could add a lot of extra tags. Any
suggestions? Thanks.
--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/

Author
16 Jan 2007 2:10 AM
Gaurav Vaish (MasterGaurav)
<div align='center'>
</div>


--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujinionline.com
-----------------------------------------


Show quoteHide quote
"Nathan Sokalski" <njsokal***@hotmail.com> wrote in message
news:%23EDescQOHHA.4604@TK2MSFTNGP06.phx.gbl...
> As most of us probably know, the <center> tag is deprecated. Because many
> elements and controls have an align attribute, centering them is easy
> enough. However, certain elements/controls do not (such as the ASP.NET
> Button and Label controls). For the ASP.NET label control I usually just
> add the following attributes:
>
> Width="100%" style="text-align:center;"
>
> However, this does not work for controls such as the ASP.NET Button
> control. The only solution I can think of is to nest it inside of <div
> align="center"></div> tags. However, this could add a lot of extra tags.
> Any suggestions? Thanks.
> --
> Nathan Sokalski
> njsokal***@hotmail.com
> http://www.nathansokalski.com/
>
Author
16 Jan 2007 2:57 AM
Nathan Sokalski
As I said in my original message, I have used that, but would like to have a
way that does not involve any extra tags (in other words, I would like to do
it using CSS). Any other ideas? Thanks.
--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/

Show quoteHide quote
"Gaurav Vaish (MasterGaurav)" <gaurav.vaish.nospam@nospam.gmail.com> wrote
in message news:%23Cg6aOROHHA.3916@TK2MSFTNGP02.phx.gbl...
> <div align='center'>
> </div>
>
>
> --
> Happy Hacking,
> Gaurav Vaish | www.mastergaurav.com
> www.edujini-labs.com
> http://eduzine.edujinionline.com
> -----------------------------------------
>
>
> "Nathan Sokalski" <njsokal***@hotmail.com> wrote in message
> news:%23EDescQOHHA.4604@TK2MSFTNGP06.phx.gbl...
>> As most of us probably know, the <center> tag is deprecated. Because many
>> elements and controls have an align attribute, centering them is easy
>> enough. However, certain elements/controls do not (such as the ASP.NET
>> Button and Label controls). For the ASP.NET label control I usually just
>> add the following attributes:
>>
>> Width="100%" style="text-align:center;"
>>
>> However, this does not work for controls such as the ASP.NET Button
>> control. The only solution I can think of is to nest it inside of <div
>> align="center"></div> tags. However, this could add a lot of extra tags.
>> Any suggestions? Thanks.
>> --
>> Nathan Sokalski
>> njsokal***@hotmail.com
>> http://www.nathansokalski.com/
>>
>
>
Author
16 Jan 2007 8:55 AM
Eliyahu Goldin
Do you mean aligning the text inside a button? Aligning with
style="text-align:xxx" does work for this.And the text is already centered
by default. Do you mean something else?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Show quoteHide quote
"Nathan Sokalski" <njsokal***@hotmail.com> wrote in message
news:%23EDescQOHHA.4604@TK2MSFTNGP06.phx.gbl...
> As most of us probably know, the <center> tag is deprecated. Because many
> elements and controls have an align attribute, centering them is easy
> enough. However, certain elements/controls do not (such as the ASP.NET
> Button and Label controls). For the ASP.NET label control I usually just
> add the following attributes:
>
> Width="100%" style="text-align:center;"
>
> However, this does not work for controls such as the ASP.NET Button
> control. The only solution I can think of is to nest it inside of <div
> align="center"></div> tags. However, this could add a lot of extra tags.
> Any suggestions? Thanks.
> --
> Nathan Sokalski
> njsokal***@hotmail.com
> http://www.nathansokalski.com/
>
Author
16 Jan 2007 7:25 PM
Nathan Sokalski
No, I am referring to horizontally centering the button on the page (or
within the div, td, or other tag that it is contained in). Thanks.
--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/

Show quoteHide quote
"Eliyahu Goldin" <REMOVEALLCAPITALSeEgGoldD***@mMvVpPsS.org> wrote in
message news:OPDWWxUOHHA.4172@TK2MSFTNGP04.phx.gbl...
> Do you mean aligning the text inside a button? Aligning with
> style="text-align:xxx" does work for this.And the text is already centered
> by default. Do you mean something else?
>
> --
> Eliyahu Goldin,
> Software Developer & Consultant
> Microsoft MVP [ASP.NET]
> http://msmvps.com/blogs/egoldin
> http://usableasp.net
>
>
> "Nathan Sokalski" <njsokal***@hotmail.com> wrote in message
> news:%23EDescQOHHA.4604@TK2MSFTNGP06.phx.gbl...
>> As most of us probably know, the <center> tag is deprecated. Because many
>> elements and controls have an align attribute, centering them is easy
>> enough. However, certain elements/controls do not (such as the ASP.NET
>> Button and Label controls). For the ASP.NET label control I usually just
>> add the following attributes:
>>
>> Width="100%" style="text-align:center;"
>>
>> However, this does not work for controls such as the ASP.NET Button
>> control. The only solution I can think of is to nest it inside of <div
>> align="center"></div> tags. However, this could add a lot of extra tags.
>> Any suggestions? Thanks.
>> --
>> Nathan Sokalski
>> njsokal***@hotmail.com
>> http://www.nathansokalski.com/
>>
>
>