1

1 PROBLEM.- I can't align the 2 inputs forms in the subheader

2 PROBLEM.- I need to show the words "register" and "login" again when you click outside the "subheader" except when you write something in the inputs

$(document).ready(function() {
    $('.register').click(function() {
        $('.register').hide();
 });
});
$(document).ready(function() {
    $('.registers').hide();
});
$(document).ready(function() {
    $('.register').click(function() {
        $('.registers').show();
 });
});
.subheader {
 background: #F3F3F3;
 margin: 0 auto;
 width: 100%;
 height: 30px;

}
.register p {
 display: inline-block;
 float: right;
 color: #179B75;
 font-size: 12px;
 padding: 0;
 padding-right: 8px;
}
.register {
 display: block;
 left: 75%;
 position: fixed;
 top: 5px;
 z-index: 10005;
 height: 30px;
}
.register>p>input {
 width: 100px;
 height: 20px;
 border: 1px solid #c8c8c8;
 font-family: FuturaLight;
 text-indent: 20px;
 font-size: 12px;
 float: right;
 display: none;
 color: #179B75;
}
.register>p>input:enabled{
 cursor: text;
}
.forms {
 width: 400px;
 height: 30px;
 display:inline-block;
 float:right;
}
.registers {
 width: 400px;
 height: 30px;
 display: inline-block;
 float:right;
}
.registerformsleft {
 width: 130px;
 height: 25px;
 display: inline-block;
 position: inherit;
 float: left;
}
.registerformsright {
 width: 130px;
 height: 25px;
 display: inline-block;
 position: inherit;
 float: right;
}
.register {
 cursor:pointer;
}
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8"/>
    <title>Prueba</title>
    <link rel="stylesheet" href="css/Principal.css"/>
    <link rel="stylesheet" href="css/main.css" />
    <link rel="stylesheet" href="css/jquery.bxslider.css" />
  </head>
  <body>
    <header>
          <div class="subheader">
            <div class="register">  
              <p>Login
              </p>
               <p>|</p>
              <p>Register</p>
            </div>
            <div class="forms">
              <form class="registers" action="demo_form.asp">
                <input class="registerformsleft" type="email" name="email" value="Email" placeholder="Format: algo@gmail.com" onfocus="if (this.value=='Email') this.value='';"><br>
                <input class="registerformsright" type="password" name="Password" size="10" value="Password" onfocus="if (this.value=='Password') this.value='';"><br>
                <input class="submit" type="submit" value="Submit">
              </form>
            </div> 
          </div>
    </header>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

    <script src="js/jquery.inputs.js"></script>
   </body>
</html>
Flake
  • 1,386
  • 17
  • 31
Kenny Amaro
  • 473
  • 1
  • 3
  • 14

3 Answers3

0

1 PROBLEM:

remove the br tag beetwen the two input fields and before the submit button and change your style like this:

.registerformsright {
    width: 130px;
    height: 25px;
    display: inline-block;
    position: inherit;
    margin-left: 5px;
}
Dario
  • 280
  • 2
  • 9
0

1 PROBLEM:

Just remove the <br> tag between two input elements



2 PROBLEM:

$(document).ready(function() {
  $('.register').click(function() {
    $('.register').hide()
  });
  $('.registers').hide();
  $('.register').click(function() {
    $('.registers').show();
  });

  $(document).mouseup(function(e) {
    var container = $(".registers");
    var email = $('input[name = "email"]');
    var password = $('input[name = "Password"]');
    if (!container.is(e.target) && container.has(e.target).length === 0) {
      if ((email.val() === email[0].defaultValue || !email.val()) && (password.val() === password[0].defaultValue || !password.val())) {
        container.hide();
        $('.register').show();
      }
    }
  });
});
.subheader {
  background: #F3F3F3;
  margin: 0 auto;
  width: 100%;
  height: 30px;
}
.register p {
  display: inline-block;
  float: right;
  color: #179B75;
  font-size: 12px;
  padding: 0;
  padding-right: 8px;
}
.register {
  display: block;
  left: 75%;
  position: fixed;
  top: 5px;
  z-index: 10005;
  height: 30px;
}
.register>p>input {
  width: 100px;
  height: 20px;
  border: 1px solid #c8c8c8;
  font-family: FuturaLight;
  text-indent: 20px;
  font-size: 12px;
  float: right;
  display: none;
  color: #179B75;
}
.register>p>input:enabled {
  cursor: text;
}
.forms {
  width: 400px;
  height: 30px;
  display: inline-block;
  float: right;
}
.registers {
  width: 400px;
  height: 30px;
  display: inline-block;
  float: right;
}
.registerformsleft {
  width: 130px;
  height: 25px;
  display: inline-block;
  position: inherit;
  float: left;
}
.registerformsright {
  width: 130px;
  height: 25px;
  display: inline-block;
  position: inherit;
  float: right;
}
.register {
  cursor: pointer;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<header>
  <div class="subheader">
    <div class="register">
      <p>Login
      </p>
      <p>|</p>
      <p>Register</p>
    </div>
    <div class="forms">
      <form class="registers" action="demo_form.asp">
        <input class="registerformsleft" type="email" name="email" value="Email" placeholder="Format: algo@gmail.com" onfocus="if (this.value=='Email') this.value='';">

        <input class="registerformsright" type="password" name="Password" size="10" value="Password" onfocus="if (this.value=='Password') this.value='';">
        <input class="submit" type="submit" value="Submit">
      </form>
    </div>
  </div>
</header>

Used THIS ANSWER for reference

Community
  • 1
  • 1
Flake
  • 1,386
  • 17
  • 31
0

please try this one:

Css:

.subheader {
  background: #F3F3F3;
  margin: 0 auto;
  width: 100%;
  height: 30px;
}
.register p {
  display: inline-block;
  float: right;
  color: #179B75;
  font-size: 12px;
  padding: 0;
  padding-right: 8px;
}
.register {
  display: block;
  left: 75%;
  position: fixed;
  top: 5px;
  z-index: 10005;
  height: 30px;
}
.register>p>input {
  width: 100px;
  height: 20px;
  border: 1px solid #c8c8c8;
  font-family: FuturaLight;
  text-indent: 20px;
  font-size: 12px;
  float: right;
  display: none;
  color: #179B75;
}
.register>p>input:enabled {
  cursor: text;
}
.forms {
  width: 400px;
  height: 30px;
  display: inline-block;
  float: right;
}
.registers {
  width: 400px;
  height: 30px;
  display: inline-block;
  float: right;
}
.registerformsleft {
  width: 130px;
  height: 25px;
  display: inline-block;
  position: inherit;
  float: left;
}
.registerformsright {
    width: 130px;
    height: 25px;
    display: inline-block;
    position: inherit;
    margin-left: 5px;
}
.register {
  cursor: pointer;
}

DEMO

Ivin Raj
  • 3,448
  • 2
  • 28
  • 65