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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Centered Form without float 1

Status
Not open for further replies.

fireburner69

Programmer
Aug 22, 2002
108
0
0
GR
I want to create a nice form that will not use float in order to set the labels before the input elements.
this form is inside a div that I want this div to be centered inside another div


something like that


--------------------------------------------
|.....................................................|
|.......HEADER DIV............................|
|------------------------------------------|
|.......MAIN DIV...................|.............|
|........................................|.SIDE........|
|.......------------------.........|.BAR.........|
|.......|.wanted div...|.........|.DIV.........|
|.......|....................|.........|.............|
|.......------------------.........|.............|
--------------------------------------------

This is my layout and I want wanted div to be centered inside the main div
And the form elements to be in a nice positions
I used float and stuff but its ain't working nice!
Any ideas? any links for looking there for tips about this issue!?

Thanks again for your time
 
To have labels appearing before form elements without using float is dead simple. You just don't use float:

Code:
<label>Some text</label><input type="text" />

If you want the inputs to line up with each other, that's a new requirement, and a different story. Your options there:

- Use floats
- Use absolute positioning
- Use tables

My advice is to go with the floats. Why? Because they provide the best "scalability". If they're not working for you, chances are it's because you're doing something wrong. Post your code and we shall see.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
this is what I am trying to do! and I want the form to be centered!

the path for the css is

I am newbe to this but I am trying!
Although I have dif with the float I am currently using it!
But It seams I cannot do what I want!
On the other side I do not want positioning cause I want always to centered!
and the final case I decided to quit on tables!! :) thats why I want them to do it with css!
and trying to find a way!!

Any ideas would help though!
Help again!
 
First of all, you need to add <form> to your page. From then it is simple. Add width to the form (whatever you need to fit those fieldsets in) and give margin: 0 auto; to the form as well. That will put the form in the center. If you want further centering, add text-align: center to the form as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top