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

Form in a nested div layout problem 2

Status
Not open for further replies.

jimmyshoes

Programmer
Jun 1, 2008
132
GB
The framework I use makes nested divs unavoidable and I have found that in IE7 putting a form inside a nested div creates an additional break

For example
Code:
<div style="border:#000000 1px solid;">
<div>
<form name="1" action="1.cfm" method="post"><input type="hidden" name="k"/></form>
123
</div>
</div>

I tried wrapping the input in a <p> but this did not help. If you wrap the form in a fieldset then you get a break after the div

Any ideas on how to solve this troublesome problem

What I want is a box that wraps snugly around the text '123'
 
Try setting the margin and the padding of the form to 0.
Code:
<form name="1" action="1.cfm" method="post" style="margin: 0; padding: 0;"><input type="hidden" name="k" /></form>
 
Borvik is correct, by default, form element has a margin of 1em at the bottom. This doesn't make a lot of sense, since form is not really an element that renders and neither it should be used to hold individual inputs -- it should always have a block-level element inside, which holds the form elements.

[small]Do something about world cancer today: Comprehensive cancer control information at PACT[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top