SitePoint Sponsor

User Tag List

Results 1 to 15 of 15

Hybrid View

  1. #1
    Custom User Title v1.0 FireFly's Avatar
    Join Date
    Aug 2001
    Posts
    363
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with CSS (setting align type)

    Hi everyone,

    I need some help with setting the align inside a CSS file.
    For example I have this:
    Code:
    <tr class='thead'>...</tr>
    and I want it to be aligned to the center.

    I'm new to CSS so please be gentle.
    Thanks for any help!

    Chen.

  2. #2
    SitePoint Wizard Ian Glass's Avatar
    Join Date
    Oct 2001
    Location
    Beyond yonder
    Posts
    2,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Simple:
    Code:
    .thead {
     text-align: center;
    
      // I suppose that you would like the text
      // to be in the middle of the cell, as well.
      // Don't rely on this too much, because it
      // doesn't work. ;-) (the browser’s haven't
      // implemented yet, that is)
      vertical-align: middle;
      }

  3. #3
    Custom User Title v1.0 FireFly's Avatar
    Join Date
    Aug 2001
    Posts
    363
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a lot Ian!

  4. #4
    SitePoint Wizard Ian Glass's Avatar
    Join Date
    Oct 2001
    Location
    Beyond yonder
    Posts
    2,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey, so I guess it worked. ;-)

    Anyway, I'm always glad to be helpful.

  5. #5
    Custom User Title v1.0 FireFly's Avatar
    Join Date
    Aug 2001
    Posts
    363
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes of course, worked splendid!

    Now to solve my other problems... *sigh*

  6. #6
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No need for CSS in this case...

    <tr class='thead' align="center">...</tr>

    That will center align the contents of every TD tag in that row.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  7. #7
    SitePoint Wizard Ian Glass's Avatar
    Join Date
    Oct 2001
    Location
    Beyond yonder
    Posts
    2,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by creole
    No need for CSS in this case...

    <tr class='thead' align="center">...</tr>

    That will center align the contents of every TD tag in that row.
    So will doing that with CSS. :-p

    Don't let yourself be swayed by the dark (4.0) way! Ignore Creole; he's old and cranky. :-)

  8. #8
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not cranky...just old. Right now CSS is unreliable for many things. my method will work the same in every browser.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  9. #9
    Custom User Title v1.0 FireFly's Avatar
    Join Date
    Aug 2001
    Posts
    363
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by creole
    <tr class='thead' align="center">...</tr>
    I know you can do it that way creole, it's just that I have a lot of rows like this, and it's a pain to write that attribute so many times when I can just stick it in my .css file.

    Thanks though.

  10. #10
    SitePoint Wizard Ian Glass's Avatar
    Join Date
    Oct 2001
    Location
    Beyond yonder
    Posts
    2,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It also clutters up your page. And besides, I can give you a few browsers where that tactic doesn't work (o.k. so most of them are non graphical, but still it applies). ;-)

  11. #11
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is very true FireFly...
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  12. #12
    Custom User Title v1.0 FireFly's Avatar
    Join Date
    Aug 2001
    Posts
    363
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Ian Glass
    It also clutters up your page. And besides, I can give you a few browsers where that tactic doesn't work (o.k. so most of them are non graphical, but still it applies). ;-)
    I'm sorry, was that directed at my method or creole's?

    My script is currently for personal use only, so I don't have to worry too much about compatibility. At least not in this stage...

    By the way thanks for all your feedback!

  13. #13
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    He was talking about my method.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  14. #14
    SitePoint Wizard Ian Glass's Avatar
    Join Date
    Oct 2001
    Location
    Beyond yonder
    Posts
    2,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sure was. :-p

  15. #15
    Super Ninja Monkey Travis's Avatar
    Join Date
    Dec 2001
    Location
    Sioux City, Iowa
    Posts
    691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the W3C doesn't like it when you specify an align attribute in a table or table row so if you want to go with the W3C guidelines use CSS
    Travis Watkins - Hyperactive Coder
    My Blog: Realist Anew
    Projects: Alacarte - Gnome Menu Editor


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
  •