FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


new to css: help with positioning





TRANScend
So I've just started playing around with CSS, and I'm having a bit of trouble positioning elements correctly. For instance, it seems that if I use 'center center' the element should end up centered in the page, correct? or if I want an image to appear in the bottom left corner of the page, I could do something like:

Quote:

img
{
position:absolute;
left:15px;
bottom:15px
}


This seems like it should work, but instead the element ends up 15 pixels off from the left side of the window and somewhere in the middle vertically... no where near 15 pixels from the bottom of the window. What am I missing regarding the positioning tag in CSS?
Marston
Personally, I wouldn't use the 'position:' attribute, nor the 'left', 'right', 'top', or 'bottom' attributes. I prefer to use 'margin:' attributes. Smile
dandelion
TRANScend wrote:
So I've just started playing around with CSS, and I'm having a bit of trouble positioning elements correctly. For instance, it seems that if I use 'center center' the element should end up centered in the page, correct? or if I want an image to appear in the bottom left corner of the page, I could do something like:

Quote:

img
{
position:absolute;
left:15px;
bottom:15px
}


This seems like it should work, but instead the element ends up 15 pixels off from the left side of the window and somewhere in the middle vertically... no where near 15 pixels from the bottom of the window. What am I missing regarding the positioning tag in CSS?

The syntax seems quite correct and behaviour is expected (I have just exemined it in Firefox and Konqueror). Can you post entire HTML and CSS code? What browser do you use?
dkill001
your css code just pads the left & bottom by 15px, you need to set equal left & right margins to center...there is no horizontal-align fxn (there is vertical-align)...check this site out for help http://www.w3.org/Style/Examples/007/center.html#block

i love css!!
frozenhead
Syntax is obviously correct in your script. I think it's how browsers will display it is the problem. Most of the time, Firefox will get it right unlike IE and vise-versa.
Here's a good reference for all new to CSS. (Just like me.Wink)

http://www.communitymx.com/content/article.cfm?cid=20B41

The W3C Box Model Problem.
Related topics
Making a New Website? Help Me!!!
rollovers in CSS
A new band: HELP!
CSS Help needed : Table emulation with divs
CSS Help...
Help wanted with CSS and iframes It works
I AM NEW USER HELP ME !
Basic CSS help needed regarding IE vs FF
Joomla CSS Help Just like any CSS Help
CSS help with existing "roll overs"
CSS help needed with list style menubar
CSS Help
CSS help positioning div
extra line from css in drop down menu
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.