Click to See Complete Forum and Search --> : 2 Div's on the same line problem :s


simon23
08-15-2009, 05:07 AM
Hi

Can anyone help I'm totally stuck :/

http://www.leahaxl.co.uk/Contact.php#contact

If you look at the link above, you'll see my contact form. My problem is that there are 2 div's here and I want to center align them side by side, but I'm getting no luck :(

If you shrink the browser window the 2nd div goes to a new line below, which doesnt look right. I was wondering how to "lock" the two divs to that line.

Any help would be much appreciated!!

Here's my CSS at the moment:

#contact_container{
margin-left:auto;
margin-right:auto;
text-align:center;
width:800px;
position:relative;
height:150px;
display:block;

}


#phpform{
background-color:green;
float:left;
margin-left:10px;
font:"Segoe UI";
color:#47878F;
position:relative;
bottom:135px;
text-align:left;
height:10px;
width:740px;

}
#phptext{
background-color:fuchsia;
float:left;
margin-left:165px;
font:"Segoe UI";
line-height:23px;
color:#47878F;
position:relative;
bottom:136px;
text-align:left;
width:60px;

}

Andyram2k
08-16-2009, 09:17 AM
Hi Simon23,
I can only see 1 div within the container, was there 2 previously?

The main thing i can see is the margin-left on the #phptext div:

#phptext{
background-color:fuchsia;
float:left;
margin-left:165px;
font:"Segoe UI";
line-height:23px;
color:#47878F;
position:relative;
bottom:136px;
text-align:left;
width:60px;
}

Remember that when you're floating divs within a containing div, the width AND margins/paddings are also taken into account, and will force one below the other.

Hope this helps in some way :)

simon23
08-16-2009, 09:27 AM
Thanks Andy (: I'll keep that in mind.
I've decided to place everything in one div which has sorted it out! I think I was trying too much.

simon23
08-16-2009, 09:33 AM
The only problem I have now is after you fill in the contact form. If you fill in the form(leave subject blank) you'll notice it clears the message field :(

Anyone got any ideas?

Andyram2k
08-16-2009, 12:13 PM
Hi Simon,
I'm guessing that there is some PHP code in that page that validates the form and remembers the input data. Check the mesage validation syntax, and that its the same as the 2 above. Hope this helps in some way.