Issues getting div to float right of another div - html

I am trying to get my registerbutton div to float right of the div - signinbutton. I do not think I can wrap the signin div around the register div to make it a parent because I have pop up code under the signinbutton div. I tried making a jsfiddle, but the effect did not result the same. To see a real view of this, my site is sundayfundayleague.com .
I need to get the register button to be inline with the Sign in one.
HTML
<div class="signinbutton">
<a class="signin" href="javascript:void(0)">Sign In</a>
</div>
<div class="registerbutton">
Register
</div>
CSS
.signinbutton {
padding: 10px;
font-size: 2.5em;
margin-top: 325px;
margin-left: 30%;
}
.registerbutton {
padding: 10px;
font-size: 2.5em;
margin-right: 30%;
float: right;
}

You can use span inside the 1st div
Demo
https://jsfiddle.net/knkvksdz/
Html
<div class="signinbutton"> <a class="signin" href="javascript:void(0)">Sign In</a>
<span class="registerbutton">
Register
</span>
</div>
Css
.signinbutton {
font-size: 2.5em;
margin-top: 325px;
margin-left: 30%;
}
.registerbutton {
float: right;
}

flip the divs around in the HTML code and use the float: left; attribute instead. Float right tends to be a bit more tricky I think and float left is the more complient one. You might have better luck doing it that way.
<div class="registerbutton">
Register
</div>
<div class="signinbutton">
<a class="signin" href="javascript:void(0)">Sign In</a>
</div>
CSS
.registerbutton {
padding: 10px;
font-size: 2.5em;
margin-right: 30%;
}
.signinbutton {
padding: 10px;
font-size: 2.5em;
margin-top: 325px;
margin-left: 30%;
float: left;
}

First of all. Try reducing your picture size. its too big. i takes time to load the page.
Here is my solution.
I will add wrapper outside those two.
<div class="wrapper">
<div class="signinbutton">
<a class="signin" href="javascript:void(0)">Sign In</a>
</div>
<div id="light" class="signInpopup">
<a class="close" href="javascript:void(0)">Close</a>
<form id="signInform" name="Sign In" action="" method="POST" autocomplete="on" accept-charset="utf-8">
<div class="center">
<input type="text" name="username" id="signInInput" placeholder="Username" autocomplete="on" required="">
<br>
<input type="password" name="password" id="signInPasswordInput" placeholder="Password" autocomplete="off" required="">
<br>
<br>
<br>
<label for="remember">
<input type="checkbox" name="remember" id="remember">Remember me</label>
<input type="hidden" name="token" value="687d55402565d69c55ab41c51eba5d76">
<label for="widebutton">
<input id="widebutton" type="submit" value="Sign In">
</label>
<br>
<br>
</div>
</form>
</div>
<div id="fade" class="black_overlay"></div>
<div class="registerbutton">
Register
</div>
</div>
and add this css to wrapper:
.wrapper{
display: inline-block;
width: 100%;
margin-top: 50px;
}
remove this from your #registerbutton
float:right
and remove from your .signinbutton
margin-top:352px;
and add .signinbutton
float:left

Related

If html content is not enough to overflow y, stick to bottom

This image probably explains best.
I have this chat functionality, very basic at the moment. When there's is enough text to overflow the page, it gives the behavior I want. The most recent message is just above the message input at the bottom. However, when there is only a few messages, the messages that exist are at the top and it leaves a big empty space between it and the message input.
Here is the relevant HTML. The text input is just position: fixed at the bottom of the screen and there's a bottom-margin on #message_outer_parent to keep it above it.
<div id="message_outer_parent">
<div id="message_content_parent"><div class="message_parent">
<span class="message_icon glyphicon glyphicon-user" style="color: #e21bcb" "=""></span>
<span class="message_username">whatever</span>
<span class="message_message">test text</span>
</div>
<div id="message_input_parent">
<form id="new_message" onsubmit="return submit_new_message()">
<input type="text" name="message_input" class="form-control" id="message_input" autocomplete="off" value="" placeholder="">
<!-- submit button positioned off screen -->
<input name="submit_message" type="submit" id="submit_message" value="true" style="position: absolute; left: -9999px">
</form>
</div>
</div>
I would like to have the messages just above the message input, even when there's only a few messages. How can I accomplish this?
Fixed position on the other div.
#message_input_parent {
position: fixed;
bottom: 5px;
}
#message_outer_parent {
position: fixed;
left: 0;
bottom: 30px;
max-height: calc(100vh - 30px);
overflow: auto;
width: 100vw;
padding: 5px;
box-sizing: border-box; /*padding and border won't increase height and width*/
}
<div id="message_outer_parent">
<div id="message_content_parent"><div class="message_parent">
<span class="message_icon glyphicon glyphicon-user" style="color: #e21bcb"></span>
<span class="message_username">whatever</span>
<span class="message_message">test text</span>
</div>
<div id="message_input_parent">
<form id="new_message" onsubmit="return submit_new_message()">
<input type="text" name="message_input" class="form-control" id="message_input" autocomplete="off" value="" placeholder="">
<!-- submit button positioned off screen -->
<input name="submit_message" type="submit" id="submit_message" value="true" style="position: absolute; left: -9999px">
</form>
</div>
</div>
Using flexbox
#message_input_parent {
position: fixed;
bottom: 5px;
}
#message_outer_parent {
height: 100vh;
width: 100vw;
padding: 5px 5px 30px 5px;
box-sizing: border-box;
display: flex;
align-items: flex-end;
}
*{margin: 0;}
<div id="message_outer_parent">
<div id="message_content_parent"><div class="message_parent">
<span class="message_icon glyphicon glyphicon-user" style="color: #e21bcb"></span>
<span class="message_username">whatever</span>
<span class="message_message">test text</span>
</div>
<div id="message_input_parent">
<form id="new_message" onsubmit="return submit_new_message()">
<input type="text" name="message_input" class="form-control" id="message_input" autocomplete="off" value="" placeholder="">
<!-- submit button positioned off screen -->
<input name="submit_message" type="submit" id="submit_message" value="true" style="position: absolute; left: -9999px">
</form>
</div>
</div>

float input left in div

I have a captcha img that is max width 200px; and I want to put the input box flush beside it.. I have tried a to float the input left but got no result it still shows ontop of the input. this is inside a div row 12-large.
<div id="captcha">
<label>Captcha</label>
<div>
<img alt="captcha" src="captimg.php">
<input class="sec" id="captcha" name="captcha" type="text" placeholder="captcha" value="">
</div>
</div>
Hope this answer help you
<div id="captcha">
<label>Captcha</label>
<div>
<img alt="captcha" src="captimg.php">
<input class="sec" style="width: 0px; z-index:0; height: 0px" id="captcha" name="captcha" type="text" placeholder="captcha" value="">
</div>
</div>
you can consider using display:inline-block here
check this snippet
img {
width: 200px;
vertical-align: middle;
}
div * {
display: inline-block;
}
div#captcha {
line-height: 30px;
border: 1px solid;
}
<div id="captcha">
<label>Captcha</label>
<div>
<img alt="captcha" src="captimg.php">
<input class="sec" id="captcha" name="captcha" type="text" placeholder="captcha" value="">
</div>
</div>
Hope it helps
#captcha img,
#captcha .sec {
float: left;
}
Use float left on both image and input. This will make them appear side by side.
Also, you have used id="captcha" twice in your code. ID's should not be repeated.

Display space betweeen 2 textfields

if you see below image or visit link1 , below text "ALREADY REGISTERED" we can see 2 textboxes with good amount space between them.
but if visit link2 than there is no space between them, please help me to display space between those textfields.
.input-box {
float: left;
width: 100%;
padding-top: 2px;
}
use tag between two input text boxes
<input type="text" name="email">
<br>
<input type="text" name="password">
both links are the same. but anyway. you do something like this.
.input-box {
float: left;
margin-bottom: 10px;
}
Here is the code:
.input-box {
padding-bottom: 20px;
display: table;
width: 100%;
}
Remove float:left from .input-box and it's work fine.
.input-box{
width: 100%;
padding-top: 2px;
}
Update your css like this,
.input-box {
float: none;
/* padding-bottom: 20px; */
width: 100%;
}
Also this if want fix the position of * Required text
.fieldset p.required {
margin-bottom: 7px;
float: right;
font-size: 12px;
margin-top: 0px;
padding-right: 0;
}
Remove this class on li inner div .input-box
your html like blow
<ul class="form-list">
<li>
<div class="">
<input type="email" placeholder="Enter Your email" title="Email Address" class="input-text required-entry validate-email" id="email" value="" name="login[username]" spellcheck="false" autocorrect="off" autocapitalize="off">
</div>
</li>
<li>
<div class="">
<input type="password" placeholder="Enter Your Password" title="Password" id="pass" class="input-text required-entry validate-password" name="login[password]">
</div>
</li>
<li>
<a class="f-left" href="http://sbdev1.kidsdial.com/customer/account/forgotpassword/">Forgot Your Password?</a>
</li>
<li class="control remember-me-box">
<div class="input-box">
<input type="checkbox" title="Remember Me" checked="checked" id="remember_meG1nd66Tg4Y" class="checkbox" name="persistent_remember_me">
</div>
<label for="remember_meG1nd66Tg4Y">Remember Me</label>
What's this?
</li>
</ul>

Bootstrap input addon on right side

I have a header-div on my Site. Inside the header I want to have a login-form in-line on the right side.
css:
#header {
position: absolute;
top: 0;
width: 100%;
height: 45px;
padding: 5;
background: #fff;
border-bottom: 1pt solid #ccc;
text-align: right;
font-weight: bold;
}
#header div {
/*display: inline-block;*/
cursor: pointer;
/*padding: 4px;*/
float: right;
text-decoration: none;
font-size: 15px;
margin-right: 5px;
}
#submitButton {
float:right;
}
html:
<div id="header">
<div id="login">
<form class="form-inline" role="form">
<div class="row">
<button type="submit" class="btn btn-default" id="submitButton">Login</button>
<div class="form-group col-sm-3">
<div class="input-group"> <span class="input-group-addon"><i class="fa fa-envelope-o fa-fw"></i></span>
<input type="email" class="form-control" placeholder="Enter email" />
</div>
</div>
<div class="form-group col-sm-3">
<div class="input-group"> <span class="input-group-addon"><i class="fa fa-key fa-fw"></i></span>
<input type="password" class="form-control" placeholder="password" />
</div>
</div>
</div>
</form>
</div>
</div>
That's what I have so far:
http://jsfiddle.net/n5qmc/254/
But if I go in the password form and press TAB I don't get in the email input field. Because of the float:right thing. I need to do this somehow different.
What is the right way to do this? Thanks!
What you need is tabindex but as your html is not good and in bootstrap you have used your own style so tabindex got different behaviour.
I have updated your fiddle with changes in html and css. Please check and let me know if its ok for you..
I have removed float and also removed extra margin which were causing problem now if you will use tab then it will go one by one and also will work better in resizing. I have also changed html so email field will be first in both case.

How do I have a textbox be 100% width without moving its siblings to the next line?

I'm interested in having a textbox take up 100% width of the remaining space but without dropping the text "name" or the button to the next line:
<div style="width: 100%; padding: 20px; background-color: #c0c0c0">
<span>Name:</span>
<span><input type="textbox" style="width:100%" /></span>
<span><input type="button" value="Search" /></span>
</div>
http://jsfiddle.net/GP2nA/1/
How can I prevent the text and button from dropping to the next line?
Tested in IE7/8, Firefox, Chrome, Opera.
Live Demo
Live Demo (minus extra wrapper div)
CSS:
#search {
padding: 20px; background-color: #c0c0c0;
overflow: auto
}
#search div {
position: relative
}
.name {
float: left
}
.input {
position: absolute;
top: 0; right: 70px; left:55px;
}
.submit {
float: right
}
HTML:
<div id="search">
<div>
<span class="name">Name:</span>
<span class="input"><input type="input" style="width:100%" /></span>
<span class="submit"><input type="button" value="Search" /></span>
</div>
</div>
(You should have a form and a label tag in there)
UPDATED: http://jsfiddle.net/QaWMN/2/
Works in: ie7, ie8, ff, chrome
If you need ie6 read this: http://www.alistapart.com/articles/conflictingabsolutepositions/
html:
<div style="padding: 20px; background-color: #c0c0c0; position: relative;">
<span class="desc">Name:</span>
<div class="full">
<input type="textbox" class="tb" /></div>
<input type="button" value="Search" class="button" />
</div>
css:
span {position: absolute;}
.full {position: absolute; left: 60px; right: 100px; top: 8px;}
.desc {left: 10px; top: 8px; width: 100px;}
.tb {width: 100%; display: block;}
.button {right: 10px; width: 80px; top: 8px; position: absolute}
You could use something like the following:
<div style="padding: 20px; background-color: #c0c0c0">
<span style="width:10%;">Name:</span>
<span><input type="textbox" style="width:80%" /></span>
<span><input style="width:10%;" type="button" value="Search" /></span>
</div>
Where we simply give all elements (label, input and button) a percentage of the width to eat. Note that you will need to examine your form elements and adjust the 10% of labels to compensate for that of your widest label, and alter the 80% width of the input field accordingly too.
Also, as commented by another, extract your styles and place them in CSS classes as opposed to writing them inline.
It doesn't really quite work that way in css without fancy JavaScript. However, you CAN get the same look to happen with a slight reworking:
<div style="width: 100%; padding: 20px; background-color: #c0c0c0">
<div style="width: 10%; float:left;">
<span>Name:</span>
<span><input type="button" value="Search" /></span>
</div>
<div style="width: 90%; float:left;"</div>
<span><input type="textbox" style="width:100%" /></span>
</div>
<div style="clear:both;"></div>
</div>
Or easier:
<div style="width: 100%; padding: 20px; background-color: #c0c0c0">
<div style="width: 10%; float:left;">Name:</div>
<input type="textbox" style="width:80% float:left;" />
<input type="button" value="Search" style="width: 10%; float:left;" />
</div>
<div style="display: table; width: 100%">
<div style="display: table-row; padding: 20px; background-color: #c0c0c0">
<span style="display: table-cell;">Name:</span>
<input type="textbox" style="display: table-cell; width:100%" />
<span style="display: table-cell;">
<input type="button" value="Search" />
</span>
</div>
</div>
See updated fiddle.
Note: The advantage of using this method is that you won't have to set a width on the label or the button.