Jump to content

Two <Div> in a <Div> by a div :)


Recommended Posts

Hi all, I am having some problems with my css, I have a big box which is going to be a form, and I want the labels on one side and field boxs on the other so it looks equal.

 

However instead of appearing left and right, they appear one after another on top of each other.

 

This is what I have

#left {
  
width:50%;
background:url(images/lft_box_bg.gif) 0 0 no-repeat #EAEADA;
border:#DDDDCA solid 7px;
margin:0 0 4px 0;
padding:5px 10px 6px 9px;
color:#878767;
}

#leftt {

left:0px;
width:150px;

}

#rightt {

left:200px;
width:300px;

}

<div id="left">
<h3>User Registration</h3>
<p>
Welcome to the signup page! Here you can signup for your user account at swaptick.co.uk allowing you to buy, sell and swap your tickets.</p><p>Start here by entering your desired username:
</p><br />
<div id="leftt">
<form action="" method="post" name="signup">

<label>Username</label><br />

<label>Password </label><br />

<label>Repeat Password</label><br />

</div>
<div id="rightt">
<input name="username" id="username" type="text" width="120px" />
<script type="text/javascript">
var username = new LiveValidation('username');
username.add( Validate.Length, { minimum: 4 } );
</script>
<img id="tick" src="tick.png" width="16" height="16"/>
<img id="cross" src="cross.png" width="16" height="16"/>
<br />

<input name"password" type="password" id="password" value="" maxlength="32" /><br />


<input name"password1" type="password" id="password1" value="" maxlength="32" />
<script type="text/javascript">
var password = new LiveValidation('password');
password.add( Validate.Length, { minimum: 4 } );
</script>
<script type="text/javascript"> 
	            var password1 = new LiveValidation('password1');
	            password1.add(Validate.Confirmation, { match: 'password'} );
	          </script>  

</div>			  
</div>
</form>

 

Link to comment
https://forums.phpfreaks.com/topic/207176-two-in-a-by-a-div/
Share on other sites

I normally do something along the lines of...

 

<div class="form_row">
        <label>label</label>
        <input type="text" name="text"/>
</div>
<div class="form_row">
        <label>label 2</label>
        <input type="text" name="text2"/>
</div>
<div class="form_row">
        <label>label 3</label>
        <input type="text" name="text3"/>
</div>

 

.form_row {
clear:left;
padding:5px; /* adjust to make look nice */
border-bottom:1px solid #ccc; /* optional */
}

.form_row label {
display:block;
float:left;
width:200px;
padding:2px 0 0 0; /* adjust to make look nice */
}

.form_row input {
display:block;
float:left;
width:300px;
}

 

I just wrote this in the textarea here so excuse the formatting, its also untested ;)

Link to comment
https://forums.phpfreaks.com/topic/207176-two-in-a-by-a-div/#findComment-1083572
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.