#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    97
    Rep Power
    11

    CSS text and font help please


    i copied some of this code from a page i liked. all it is is a background image and i want to type text over it that is in a table. the problem is i cannot center my text ("<?=$information[nickName]?>"). the text always is on the left, never in the center. i have tried different things such as
    <td align=center> as opposed to the <td valign=center> the other author has in the 2nd block, the align:center does not work with font. and i have tried appending a ;text-align:center within that SPAN tag, but that does not work either. does anyone have any advice??? thanks!

    <table border=0 cellspacing=0 cellpadding=0 width="750" style="border: solid black 2px;">
    <tr><td style="background-image:url(images/name_test.jpg); background-attachment: 100% 0%">

    <table border="0" cellspacing=0 cellpadding=1><TR><TD valign="center"><SPAN style="font-size: 14pt; font-family: arial black, helvetica; padding: 3px; align: center;"><?=$information[nickName]?></SPAN></TD></TR>
    </table>
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    New York City
    Posts
    62
    Rep Power
    11
    can you supply a link to the page you are referring to? i'll take a look at it and see if i can find a solution.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2004
    Posts
    10
    Rep Power
    0
    try aligning it with a div tag...

    <div align="center">Text goes hur</div>
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    97
    Rep Power
    11
    i'm doing the page on my home computer so it's not on the net. but it looks something like this:

    http://athletics.ucsd.edu/roster/player.php?id=588

    where the name says "Robert Eap", i want that in the middle.


    fuzic- tried the div, that does not work. thanks.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2004
    Posts
    10
    Rep Power
    0
    did you try this EXACTLY...

    <SPAN style="font-size: 28pt; font-family: arial, helvetica; padding: 3px;">

    <div align="center">Robert Eap</div>

    </SPAN>
  10. #6
  11. Insignificant Peon
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Tharsis Ridge (Martian lowlands)
    Posts
    194
    Rep Power
    11
    OK. Let's go back to the first post in this thread, and work with the example posted there.

    First this style within the <head></head> tags (or in an external stylesheet)...

    <style type="text/css">
    .param1 {text-align: center; font-size: 14pt; font-family: arial black, helvetica; padding: 3px}
    .param2 {text-align: left; font-size: 14pt; font-family: arial black, helvetica; padding: 3px}
    .param3 {text-align: right; font-size: 14pt; font-family: arial black, helvetica; padding: 3px}
    .table1 {text-align: right; width: 100%; border: solid black 2px}
    </style>

    Then these examples of text-align center, left and right, anywhere after the <body> tag...

    <table class="table1"><tr>
    <td><div class="param1">text center-aligned</div></td>
    </tr></table>

    <table class="table1"><tr>
    <td><div class="param2">text left-aligned</div></td>
    </tr></table>

    <table class="table1"><tr>
    <td><div class="param3">text right-aligned</div></td>
    </tr></table>

    Here is a working example uploaded temporarily to my server.
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    97
    Rep Power
    11
    thanks, works like a charm
  14. #8
  15. Insignificant Peon
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Tharsis Ridge (Martian lowlands)
    Posts
    194
    Rep Power
    11
  16. #9
  17. |<.+#f@#+.&.|
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Mar 2002
    Location
    norway
    Posts
    3,009
    Rep Power
    1224
    Originally Posted by fuzic
    did you try this EXACTLY...

    <SPAN style="font-size: 28pt; font-family: arial, helvetica; padding: 3px;">

    <div align="center">Robert Eap</div>

    </SPAN>
    this isn't valid html,
    an inline element cannot contain a block-level element,

IMN logo majestic logo threadwatch logo seochat tools logo