Go Back   Velocity Reviews > Newsgroups > HTML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

HTML - how to center text in css ?

 
Thread Tools Search this Thread
Old 09-22-2006, 02:17 AM   #1
Default how to center text in css ?


Actually, I need to know how to put the text in the middle of the division.
As I did with tables.
Vertical-align doesn't seem to be recognized.

www.1-small-world.com/index2.html



richard
  Reply With Quote
Old 09-22-2006, 02:50 AM   #2
Jonathan N. Little
 
Posts: n/a
Default Re: how to center text in css ?

richard wrote:
> Actually, I need to know how to put the text in the middle of the division.
> As I did with tables.
> Vertical-align doesn't seem to be recognized.
>
> www.1-small-world.com/index2.html
>


Look it up for yourself and see why...

http://www.w3.org/TR/CSS21/propidx.html

property: 'vertical-align'
applies to: inline-level and 'table-cell' elements

DIV is neither. You can set DIV to "display: table-cell;" ...but guess
what? You guessed it, it will not work in IE. Other options are padding
and line-height all a bit messy.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
  Reply With Quote
Old 09-22-2006, 04:15 AM   #3
richard
 
Posts: n/a
Default Re: how to center text in css ?


"Jonathan N. Little" <> wrote in message
news:7f2c8$451341a7$40cba7ac$...
> richard wrote:
>> Actually, I need to know how to put the text in the middle of the
>> division.
>> As I did with tables.
>> Vertical-align doesn't seem to be recognized.
>>
>> www.1-small-world.com/index2.html
>>

>
> Look it up for yourself and see why...
>
> http://www.w3.org/TR/CSS21/propidx.html
>
> property: 'vertical-align'
> applies to: inline-level and 'table-cell' elements
>
> DIV is neither. You can set DIV to "display: table-cell;" ...but guess
> what? You guessed it, it will not work in IE. Other options are padding
> and line-height all a bit messy.
>


Well check this out then

http://www.wpdfd.com/editorial/thebox/deadcentre4.html

Works good in both IE and FF.


  Reply With Quote
Old 09-22-2006, 04:56 AM   #4
Jonathan N. Little
 
Posts: n/a
Default Re: how to center text in css ?

richard wrote:
>
> "Jonathan N. Little" <> wrote in message
> news:7f2c8$451341a7$40cba7ac$...
>> richard wrote:
>>> Actually, I need to know how to put the text in the middle of the
>>> division.
>>> As I did with tables.
>>> Vertical-align doesn't seem to be recognized.
>>>
>>> www.1-small-world.com/index2.html
>>>

>>
>> Look it up for yourself and see why...
>>
>> http://www.w3.org/TR/CSS21/propidx.html
>>
>> property: 'vertical-align'
>> applies to: inline-level and 'table-cell' elements
>>
>> DIV is neither. You can set DIV to "display: table-cell;" ...but guess
>> what? You guessed it, it will not work in IE. Other options are
>> padding and line-height all a bit messy.
>>

>
> Well check this out then
>
> http://www.wpdfd.com/editorial/thebox/deadcentre4.html
>
> Works good in both IE and FF.
>
>

As I said a bit messy as opposed to:

DIV.deadcenter {
display: table-cell; text-align: center; vertical-align: middle;
}

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
  Reply With Quote
Old 09-22-2006, 05:14 AM   #5
richard
 
Posts: n/a
Default Re: how to center text in css ?


"Jonathan N. Little" <> wrote in message
news:46fb5$45135f09$40cba7ac$...
> richard wrote:
>>
>> "Jonathan N. Little" <> wrote in message
>> news:7f2c8$451341a7$40cba7ac$...
>>> richard wrote:
>>>> Actually, I need to know how to put the text in the middle of the
>>>> division.
>>>> As I did with tables.
>>>> Vertical-align doesn't seem to be recognized.
>>>>
>>>> www.1-small-world.com/index2.html
>>>>
>>>
>>> Look it up for yourself and see why...
>>>
>>> http://www.w3.org/TR/CSS21/propidx.html
>>>
>>> property: 'vertical-align'
>>> applies to: inline-level and 'table-cell' elements
>>>
>>> DIV is neither. You can set DIV to "display: table-cell;" ...but guess
>>> what? You guessed it, it will not work in IE. Other options are padding
>>> and line-height all a bit messy.
>>>

>>
>> Well check this out then
>>
>> http://www.wpdfd.com/editorial/thebox/deadcentre4.html
>>
>> Works good in both IE and FF.
>>
>>

> As I said a bit messy as opposed to:
>
> DIV.deadcenter {
> display: table-cell; text-align: center; vertical-align: middle;
> }


I have tried it and it does not appear to work.
Eventually I may find something that will.

  Reply With Quote
Old 09-22-2006, 02:25 PM   #6
Jonathan N. Little
 
Posts: n/a
Default Re: how to center text in css ?

richard wrote:

> I have tried it and it does not appear to work.
> Eventually I may find something that will.
>


It will *not* work in IE but *does* in "modern" browsers, that was my
point. Therefore if you wish to accommodate Ol'IE you have to resort to
a kludge of nested elements and playing with margins, padding and stuff....

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump