Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New to the CF scene
    Join Date
    Dec 2003
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    A text postition in a table cell

    How can I center a text in a cell ? But not to center in from the left and right but from the top and the bottom ? For example if I have Verdane font with size 1 and the cell is 14px and I want it to be in center from the top and the bottom
    Thanks to all
    Last edited by gamehack; 01-27-2004 at 03:29 PM.

  • #2
    New Coder
    Join Date
    Jan 2004
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i am not 100% sure but i thought it was valign="midle"

  • #3
    Regular Coder
    Join Date
    Jan 2004
    Location
    Maryland
    Posts
    468
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, it is valign="middle"

  • #4
    New to the CF scene
    Join Date
    Dec 2003
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks...

  • #5
    J&J
    J&J is offline
    New Coder
    Join Date
    Sep 2003
    Location
    your temp folder
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts

    yup...

    To center vertically within a table cell, sentence, a line/group of images, etc. use
    valign=" ".
    The options to enclose in quotes are: top, middle, bottom.
    ~ J&J ~
    "Sometimes I feel like I'm rearranging deck chairs on the Titanic."


    Work | Family | Community

  • #6
    me'
    me' is offline
    Senior Coder
    Join Date
    Nov 2002
    Location
    Warwickshire, England
    Posts
    1,229
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Shame CSS has no well supported alternative, this is presentational markup.
    David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
    W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!

  • #7
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by me'
    Shame CSS has no well supported alternative, this is presentational markup.
    vertical-align: middle; --- You mean this CSS doesn't work?
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #8
    New Coder
    Join Date
    Jun 2002
    Location
    Portland, Oregon
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts
    As long as you don't specify valign="", whatever you put in a <td> will automatically default to the middle vertical position anyway.
    Llamasery Enlightened Internet Strategies
    "Psychics will lead dogs to your body." --Alleged fortune cookie message

  • #9
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Originally posted by Roy Sinclair
    vertical-align: middle; --- You mean this CSS doesn't work?
    It works, but it doesn't do the same thing. vertical-align aligns inline elements to different positions in the linebox, not box elements to different positions in the box.
    'vertical-align'
    Property name: 'vertical-align'
    Value: baseline | sub | super | top | text-top | middle | bottom | text-bottom | <percentage> | <length> | inherit
    Initial: baseline
    Applies to: inline elements
    Inherited: no
    Percentage values: refer to the 'line-height' of the element itself
    Media groups: visual

    This property affects the vertical positioning inside a line box of the boxes generated by an inline element. The following values only have meaning with respect to a parent inline element; they have no effect if no parent exists:

    'baseline'
    Align the baseline of text in the box with the baseline of text in the parent box. If the box doesn't contain text, align the bottom of the box with the parent's baseline.
    'middle'
    Align the vertical midpoint of the box with the baseline of text in the parent box plus half the x-height of the parent.
    'sub'
    Subscript the box. This value has no effect on the font size of the element's text.
    'super'
    Superscript the element. This value has no effect on the font size of the element's text.
    'text-top'
    Align the top of the box with the top of the parent element's font
    'text-bottom'
    Align the bottom of the box with the bottom of the parent element's font

    The remaining values refer to the line box in which the generated box appears:

    'top'
    Align the top of the box with the top of the line box.
    'bottom'
    Align the bottom of the box with the bottom of the line box.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #10
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by liorean
    It works, but it doesn't do the same thing. vertical-align aligns inline elements to different positions in the linebox, not box elements to different positions in the box.
    Note that it also effects "table cell elements" per http://www.w3.org/TR/CSS2/visudet.ht...ertical-align.

    The source you quoted is incomplete.
    Last edited by Roy Sinclair; 01-29-2004 at 05:58 PM.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #11
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Hmm, seems like the version of CSS2 that I have on my harddrive is an earlier draft. That change had not been made then.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards


  •  

    Posting Permissions

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