Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Issue with centering a floating div...

Status
Not open for further replies.

snowboardr

Programmer
Joined
Feb 22, 2002
Messages
1,401
Location
PH
I have a div inside a main div :

Code:
#innerContent { position:relative; top:2em; width:100%; left:0; padding:1px; margin-right:18%; }

and i am trying to get these divs to center inside the above div:

Code:
#prod {float:left; position:relative; text-align:center; margin-top:9px; top:4em; min-width:102px; margin-left:1em; padding:1px; border:1px solid #CCC; background-color:#EEE;}
#prod2 {float:left; position:relative; text-align:center; margin-top:9px; top:4em; min-width:102px; margin-left:1em; padding:1px; border:1px solid #CCC; background-color:#EEE;}
#prod3 {float:left; position:relative; text-align:center; margin-top:9px; top:4em; min-width:102px; margin-left:1em; padding:1px; border:1px solid #CCC; background-color:#EEE;}
#prod4 {float:left; position:relative; text-align:center; margin-top:9px; top:4em; min-width:102px; margin-left:1em; padding:1px; border:1px solid #CCC; background-color:#EEE;}

I'm just not sure how i can do this, as i have tried other things other than float on prod[x] but just can't seem to get the result i would like... it will show up like this with float:

innerContent
----------------------------------




prod[x] prod[x] prod[x] prod[x]



----------------------------------
innerContent [end]


and i would like this


innerContent
--------------------------------------



--->centered
prod[x] prod[x] prod[x] prod[x]



--------------------------------------
innerContent [end]

Jason

[red]Army[/red] : [white]Combat Engineer[/white] : [blue]21B[/blue]

 
How can they be floated left and yet centred? Surely it would be either left OR centred, not AND?

Hope this helps,
Dan




Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top