0

I have the following code and I am unable to access the HTML to edit.

<form>
   <div class="LoginDiv">
      <input type="text" name="user_login" tabindex="1" placeholder="Email"/>
   </div>
   <div class="LoginDiv">
      <input type="password" name="user_password" tabindex="2" placeholder="Password" />
   </div>
   <button type="submit">LOGIN</button>
</form>

This displays as per the image.

enter image description here

I am able to access the CSS and I would like to be able to force the input fields so they are inline.

Is this possible?

Thanks,

John

1
  • what exactly you want to happen? inputs and button are inline? in one straight line? Commented Jul 21, 2016 at 8:22

5 Answers 5

2

Here's what you need I guess

.LoginDiv {
  display: inline-block;
 }

https://jsfiddle.net/21o0uL52/

Sign up to request clarification or add additional context in comments.

Comments

1

You can use float:left on input and added button in div with class submit. By using clear:both avoided to float

form input{
 float:left;
}
.submit{
  clear:both;
}
<form>
   <div class="LoginDiv">
      <input type="text" name="user_login" tabindex="1" placeholder="Email"/>
   </div>
   <div class="LoginDiv">
      <input type="password" name="user_password" tabindex="2" placeholder="Password" />
   </div>
   <div class="submit"><button type="submit">LOGIN</button></div>
</form>

Comments

0

You can give the float: left to the class of these div's, something like this:

.LoginDiv {
  float: left;
}
<form>
  <div class="LoginDiv">
    <input type="text" name="user_login" tabindex="1" placeholder="Email" />
  </div>
  <div class="LoginDiv">
    <input type="password" name="user_password" tabindex="2" placeholder="Password" />
  </div>
  <button type="submit">LOGIN</button>
</form>

jsFiddle

Comments

0

You can use inline table and table cell.

display:inline-table;

See fiddle https://jsfiddle.net/mLjh8230/

Comments

0

You only must use display: inline. EDITED

div{
  display: inline;
}
<form>
   <div class="LoginDiv">
      <input type="text" name="user_login" tabindex="1" placeholder="Email"/>
   </div>
   <div class="LoginDiv">
      <input type="password" name="user_password" tabindex="2" placeholder="Password" />
   </div>
   <button type="submit">LOGIN</button>
</form>

JSFIDDLE

3 Comments

The OP has mentioned that he does not have access to edit the html
Good observation! Edited
It would bad to make the div inline. They can be other divs on the page and they might get inlined too, breaking the page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.