#1
  1. Rock Star
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    K-town
    Posts
    53
    Rep Power
    12

    css position from bottom AND center?


    Ok, css is great for some things, but I can't figure out how to position something x pixels from the bottom and still center it (yes i've tried replacing the center tags with a div that has text-align:center)
    PHP Code:
    <html>
        <
    body>
            <
    div style="position:absolute; bottom:0px;">
                <
    center>
                    <
    font size="1" color="#C0CCCC">
                        &
    copy2004 Drew Peterson
                        
    <br />
                        
    All Rights Reserved
                    
    </font>
                </
    center>
            </
    div>
        </
    body>
    </
    html
    any ideas?

    I could use javascript to get the page width, then (pagewidth/2)-(textwidth/2) would give me centered text...but getting the page width is unreliable most of the time...so i'd rather solve it some way closer to what i've started. thanks.
    PHP and XML
    Let's talk about SAX
  2. #2
  3. Rock Star
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    K-town
    Posts
    53
    Rep Power
    12
    got inspiration from some picture resizing thread i saw...see, the center is centered, within the div, which is only the width of the text itself, and since i didn't give it a left that's why it pulled the the very left (normal flow). But, if i make the containing div 100% the width of the page (width:100%) then the center has room to work and will center on the page, and even grow/shrink as the page resizes.
  4. #3
  5. |<.+#f@#+.&.|
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Mar 2002
    Location
    norway
    Posts
    3,009
    Rep Power
    1224
    you shouldn't use tags like font and center.
    both have been deprecated, use css to control the layout.

    Code:
    <div style="position:absolute; bottom:0px; text-align:center; color:#c0cccc; font-size:0.8em; width:100% ">
    	&copy; 2004 Drew Peterson
    	<br />
    	All Rights Reserved
    </div>

IMN logo majestic logo threadwatch logo seochat tools logo