SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Zealot Tech9's Avatar
    Join Date
    Oct 2004
    Location
    Arlington, TX
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help with text positioning

    i would like to place the time on my nav bar but im having a problem i would like to position the text 25 pixels to the right from the right side but i cant seem to find the css code to do so pls help me.

  2. #2
    SitePoint Addict RamsayX's Avatar
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use margin-right: 25px; for this. Should work ... let me know if that helps.
    Personal Portfolio
    Paul O'B is the CSS god

  3. #3
    SitePoint Zealot Tech9's Avatar
    Join Date
    Oct 2004
    Location
    Arlington, TX
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i couldnt get it to work =[ i dont know what i did wrong heres my code if it helps

    css
    .tdnavtext {
    margin-right: 25px;
    }
    html
    <td valign="top" class="tdnavtext" background="nav.jpg" width="980" height="50">testblah</td>
    www.teamsik.net/teamsiknet

    thx

  4. #4
    SitePoint Addict RamsayX's Avatar
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm try a float:right as well?
    Personal Portfolio
    Paul O'B is the CSS god

  5. #5
    SitePoint Zealot Tech9's Avatar
    Join Date
    Oct 2004
    Location
    Arlington, TX
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    float:right ??? sorry i dont know a hole lot of css

  6. #6
    SitePoint Addict RamsayX's Avatar
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just add that to your CSS property, like:

    .tdnavtext {
    margin-right: 25px;
    float:right;
    }

    Does that work?
    Personal Portfolio
    Paul O'B is the CSS god

  7. #7
    SitePoint Zealot Tech9's Avatar
    Join Date
    Oct 2004
    Location
    Arlington, TX
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just put it in didnt work ='[

  8. #8
    SitePoint Zealot Tech9's Avatar
    Join Date
    Oct 2004
    Location
    Arlington, TX
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anyone?

  9. #9
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,295
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    You could just use text-align:right and add 25px padding to the right side of the cell.

    If you have other content on that line then you may want to float as Ramsay suggests.
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <style type="text/css">
    .tdnavtext p{
    margin-right: 25px;
    text-align:right;
    float:right;
    display:inline;/*ie double margin fix*/
    }
    </style>
    </head>
    <body>
    <table cellspacing="0" cellpadding="0">
      <tr>
    	<td valign="top" class="tdnavtext" background="nav.jpg" width="980" height="50"><p>testblah</p></td> 
      </tr>
    </table>
    </body>
    You may find that you need to give the float a width if you have other content on the same line etc.. Just remember that floated content must come befor anything else on the same line otherwise it drops to the next line.

    If you have other contetn on the line then you may want to change the float to a span. e.g.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <style type="text/css">
    .tdnavtext span {
    margin-right:25px;
    text-align:right;
    float:right;
    display:inline;/*ie double margin fix*/
    }
    </style>
    </head>
    <body>
    <table cellspacing="0" cellpadding="0">
      <tr>
    	<td valign="top" class="tdnavtext" background="nav.jpg" width="980" height="50"><p><span>This sits right</span>Other content sits left </p></td> 
      </tr>
    </table>
    </body>
    </html>
    Hope that helps.

    Paul

  10. #10
    SitePoint Zealot Tech9's Avatar
    Join Date
    Oct 2004
    Location
    Arlington, TX
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thx


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
  •