Unable to line up 2 input fields side by side

Hello everybody,

I’m working on an interface for file upload but I can’t seem to line up the two input fields so there displayed side by side.
desired results: Choose file(button) - user selected file.png - remove button
I added a screen shot of what it looks like as of now.

     **HTML script** 
   <div class="form-group form-group-sm">				
	<label>Upload images</label>
	<div class="panel panel-default">
		<div class="panel-body">
			<span class="h5"> 
				<ul> 
					<li>Excepted file formats: JPEG, PNG, & GIF. </li>
					<li>Max number of files you can upload: 3 </li>
				</ul>
			</span>
			<hr>						
			<div id="addField"></div>					
			<button  type="submit"  id="add-file-field">Add Image</button>
		</div>
	</div>		
</div>

the java scrip that controls the buttons:

$(function(){
	var maxupload = 3;
	var total = 0;
	  
	$('#add-file-field').click(function(e){  
	  e.preventDefault();
	  $("#addField").append('<div style="margin:0px; padding:0px;" class="added-field"><input type="file" name="data[]"><input type="submit" class="remove-btn" value="Remove"></div>');
	  total ++;
	  if (total == 3)  { $(this).attr("disabled", "disabled");   }
	  });
	
	$(document).on('click', '.remove-btn', function(event) {
	  $(this).parent().remove();
	  if (total == maxupload){
		$("#add-file-field").removeAttr("disabled");
	  }
	  total--;
	});
  });

Any help you can provide would be greatly appreciated.
Thanks
r

Can you give us your CSS?

Hi RyanReese,

Thanks for the replay back.
I’m using bootstrap and as of now i haven’t changed any of the default settings other then to add 2 lines of css the the upload script

.added-field{padding:7px;}
#add-file-field{margin:10px;}
div#addField {
display: inline-block;
}

Does that do what you want?

nop…

That’s not all the html/css is it though?!..What’s containing the choose file button and text beside it? Whatever it is, set that container as inline-block along with the remove button container… or set both as block float left/right respectively.

#choose-file-container{
display:block;
float:left;
}

#addField{
display:block;
float:right;
}

Floating changes the display to block so no need for that.

time to clean up my css! Cheers

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.