I have two divs nested inside another and no matter what I have tried I can't get the second nested div (bookmarklet-wrapper) to float beside the first(form-wrapper)? I thought maybe it was something to do with the widths but this didn't help and also tried using a "clearfix" but this still didn't help.
My HTML is as follows:
<div id="prof-wrapper">
<div id="editprofile-form-wrapper">
<div id="title">
<h1>Edit Profile</h1>
<p>This information appears on your personal user page</p>
</div><!--End of title-->
<div class="form-horizontal">
<?php if(isset($image)){echo $image;}?>
<div id="thumbs" style="width:300px"></div>
<form id="cropimage" method="post" enctype="multipart/form-data">
<fieldset class="control-group">
<label class="control-label" for="firstname">Firstname</label>
<div class="controls">
<input id="firstname" type="text" name="fname">
</div>
</fieldset>
<fieldset class="control-group">
<label class="control-label" for="lastname">Surname</label>
<div class="controls">
<input id="lastname" type="text" name="secound">
</div>
</fieldset>
<fieldset class="control-group">
<label class="control-label" for="email">Email</label>
<div class="controls">
<input id="email" type="text" name="email">
</div>
</fieldset>
<fieldset class="control-group">
<label class="control-label" for="user_location">Location</label>
<div class="controls">
<input id="user_location" type="text" value="" name="user[location]">
<p>Where art thou?</p>
</div>
</fieldset>
<fieldset class="control-group">
<label class="control-label" for="bio">Bio</label>
<div id="user_description_box" class="controls">
<textarea id="bio" class="input-xlarge" name="bio" style="width: 243px; height: 122px;"></textarea>
<p class="bio-label">About yourself in<strong>160</strong>characters or less.</p>
</div>
</fieldset>
<div class="form-actions">
<button id="submitButton" class="btn primary-btn" type="submit" name="submit">Save changes</button>
</div>
</form>
<form id="cropimage" method="post" enctype="multipart/form-data">
<fieldset class="control-group">
<label class="control-label" for="photoimg">Profile photo upload</label>
<div id="user_description_box" class="controls">
<input id="photoimg" type="file" value="" name="photoimg">
<input type="hidden" name="image_name" id="image_name" value="<?php echo($actual_image_name)?>" />
<!--<p class="bio-label">About yourself in <strong>160</strong> characters or less.</p>-->
</div>
</fieldset>
<div class="form-actions">
<input type="submit" class="btn primary-btn" id="photoSubmit" name="submit" value="Photo Submit" />
</div>
</form>
</div><!--End of horizontal form-->
</div><!--End of form wrapper-->
<div class="clearfix"></div>
<!-----------------------------------------Start of bookmarklet-------------------------------------------------->
<div id="bookmarklet-wrapper">
<h1 id="welcometext">Welcome to <img src="images/logo_text.png" alt="NetSushi Logo" title="Net Sushi" id="instrustionlogo" width="100px"/></h1>
<h2 id="bminstructions">The Bookmarklet below should be dragged to your bookmarks bar so that you can share content with your friends on <!--<img src="images/logo_text.png" alt="NetSushi Logo" title="Net Sushi" id="instrustionlogo" width="100px"/>
<a style="text-decoration:none;
background:#25A6E1;
background:-moz-linear-gradient(top,#25A6E1 0%,#188BC0 100%);
background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#25A6E1),color-stop(100%,#188BC0));
background:-webkit-linear-gradient(top,#25A6E1 0%,#188BC0 100%);
background:-o-linear-gradient(top,#25A6E1 0%,#188BC0 100%);
background:-ms-linear-gradient(top,#25A6E1 0%,#188BC0 100%);
background:linear-gradient(top,#25A6E1 0%,#188BC0 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#25A6E1',endColorstr='#188BC0',GradientType=0);
padding:8px 13px;
color:#fff;
font-family:'Helvetica Neue',sans-serif;
font-size:17px;
border-radius:4px;
-moz-border-radius:4px;
-webkit-border-radius:4px;
border:1px solid #1A87B9;
position: relative;
top: 20px;"
href="javascript:
(function () {
function loadjscssfile(filename, filetype){
if (filetype=='js'){
var fileref=document.createElement('script');
fileref.setAttribute('type','text/javascript');
fileref.setAttribute('id','jsDoc');
fileref.setAttribute('src', filename);
}else if (filetype=='css'){
var fileref=document.createElement('link');
fileref.setAttribute('rel', 'stylesheet');
fileref.setAttribute('id', 'cssDoc');
fileref.setAttribute('type', 'text/css');
fileref.setAttribute('href', filename);
}
if (typeof fileref!='undefined')
document.getElementsByTagName('head')[0].appendChild(fileref);
}
var cssDoc = document.getElementById('cssDoc');
if (cssDoc == null){
loadjscssfile('http://www.netsushi.net/css/css/bookmarklet.css', 'css');
}
var jsDoc = document.getElementById('jsDoc');
if (jsDoc == null){
loadjscssfile('http://www.netsushi.net/js/bookmarklet.js', 'js');
}else{
if ($('#feeder_bm_main').is(':visible')){
$('#feeder_bm_main').hide();
}else{
$('#feeder_bm_main').show();
}
}
void(0)
}())
;"-->
>NetSushi</a>
</div><!--End of bookmarklet wrapper-->
</div><!--end of edit-page-content-->
I'm still unsure how to correctly format my CSS to post it but you can see exactly what is going on in this fiddle if you have a moment to help me out?
http://jsfiddle.net/DannyW86/3gMuP/
If you simply add float: left to your form-wrapper, it should work : http://jsfiddle.net/3gMuP/1/
You can also use display:inline-block; in the 2 divs you want to have next to each other.
This works for me:
#editprofile-form-wrapper {
width: 50%;
float: left;
}
I don't have any other CSS what-so-ever ... and the 2 columns now sit next to each other.
Related
I am new to HTML CSS but I know how to copy things.
Here is the case, as I copy the HTML from https://formsubmit.co/live-demo to my Brackets, it will lose all layout features.
I tried fixing it with:
h1 {
text-align: center;
margin: 35px 0 20px 0 !important;
}
<div class="container">
<h1>FormSubmit Demo</h1>
<form target="_blank" action="https://formsubmit.co/your#email.com" method="POST">
<div class="form-group">
<div class="form-row">
<div class="col">
<input type="text" name="name" class="form-control" placeholder="Full Name" required>
</div>
<div class="col">
<input type="email" name="email" class="form-control" placeholder="Email Address" required>
</div>
</div>
</div>
<div class="form-group">
<textarea placeholder="Your Message" class="form-control" name="message" rows="10" required></textarea>
</div>
<button type="submit" class="btn btn-lg btn-dark btn-block">Submit Form</button>
</form>
</div>
Thanks a lot for helping.
Next time, click Resources
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">
<link rel="stylesheet" href="main.css">
</head>
<body>
<div class="container">
<h1>FormSubmit Demo</h1>
<form target="_blank" action="https://formsubmit.co/your#email.com" method="POST">
<div class="form-group">
<div class="form-row">
<div class="col">
<input type="text" name="name" class="form-control" placeholder="Full Name" required>
</div>
<div class="col">
<input type="email" name="email" class="form-control" placeholder="Email Address" required>
</div>
</div>
</div>
<div class="form-group">
<textarea placeholder="Your Message" class="form-control" name="message" rows="10" required></textarea>
</div>
<button type="submit" class="btn btn-lg btn-dark btn-block">Submit Form</button>
</form>
</div>
</body>
</html>
main.css
h1 {
text-align: center;
margin: 35px 0 20px 0 !important;
}
I have implemented modal as a pop up. On desktop its coming properly but on mobile screen its coming at the one corner and not fully also.
Code for modal
<div class="modal fade" id="loginmodal" role="dialog" style="display:none;position: fixed;top: 50%;left: 50%;margin-top: -15%;margin-left: -25%;margin-bottom: -50px;width:80%;height:80%;">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content" style="background-color: #2E5D2E;">
<div class="modal-body">
<h1 class="cover-heading" style="text-shadow: -1px 1px 1px #0A0401;font-weight: 900;font-size: xx-large;">Pick Ur Desired Location</h1>
<h5 class="cover-heading" style="text-shadow: -1px 1px 1px #0A0401;">We will get back to you promptly.</h5>
<form id="loginform" name="loginform" method="get" action="/query" class="form-horizontal">
<div class="form-group">
<div class="col-sm-2 control-label" style="color: #0E0E0E;white-space: nowrap;" >
<label for="location" style="margin-left: 24px;">Your Location</label>
<div class="col-sm-10">
<select class="selectpicker form-control" id="location" name="location" style="width: 664%;" required="true">
<option value="jaipur" disabled="disabled" selected="selected">Jaipur</option>
<option value="shimla">Shimla</option>
<option value="bangalore">Bangalore</option>
</select>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-2 control-label" style="margin:auto; border-radius:0;color: #0E0E0E;">
<label for="username">Email Id:</label>
<div class="col-sm-10">
<input name="emailId" class="form-control" id="emailId" tabindex="1" type="email" required="true" style="width: 664%;"/>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-2 control-label" style="margin:auto; border-radius:0;color: #0E0E0E;">
<label for="username" style="margin-left: 5px;">Phone No:</label>
<div class="col-sm-10">
<input type="text" name="phoneno" id="phoneno" class="form-control ip_text" tabindex="2" style="width: 664%;" pattern="^([0-9]{10})?$" required="required"/>
</div>
</div>
</div>
<button type="submit" class="btn btn-success btn-block"> Submit Your Interest</button>
</form>
</div>
</div>
</div>
</div>
On mobile screen its looking like this
how Can I make it to come center of the screen with out disrupting its location on big screen like desktop. Can someone suggest me some idea to do it ?
The inline styles you're applying are causing alot of the issues (I removed any related to size-position) and you are putting your input and label inside col-sm-2 when you just want the label itself to use col-sm-2, not the input and label encased together inside of those columns.
<label for="location" class="col-sm-2 control-label" style="color: #0E0E0E;white-space: nowrap;">Your Location</label>
You can use jQuery to keep your modal on the center of the page.
See working example.
$(function() {
function reposition() {
var modal = $(this),
dialog = modal.find('.modal-dialog');
modal.css('display', 'block');
dialog.css("margin-top", Math.max(0, ($(window).height() - dialog.height()) / 2));
}
$('.modal').on('show.bs.modal', reposition);
$(window).on('resize', function() {
$('.modal:visible').each(reposition);
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#loginmodal">Launch demo modal</button>
<div class="modal fade" id="loginmodal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content" style="background-color: #2E5D2E;">
<div class="modal-body">
<h1 class="cover-heading" style="text-shadow: -1px 1px 1px #0A0401;font-weight: 900;font-size: xx-large;">Pick Ur Desired Location</h1>
<h5 class="cover-heading" style="text-shadow: -1px 1px 1px #0A0401;">We will get back to you promptly.</h5>
<form id="loginform" name="loginform" method="get" action="/query" class="form-horizontal">
<div class="form-group">
<label for="location" class="col-sm-2 control-label" style="color: #0E0E0E;white-space: nowrap;">Your Location</label>
<div class="col-sm-10">
<select class="selectpicker form-control" id="location" name="location" required="true">
<option value="jaipur" disabled="disabled" selected="selected">Jaipur</option>
<option value="shimla">Shimla</option>
<option value="bangalore">Bangalore</option>
</select>
</div>
</div>
<div class="form-group">
<label for="username" class="col-sm-2 control-label" style=" border-radius:0;color: #0E0E0E;">Email Id:</label>
<div class="col-sm-10">
<input name="emailId" class="form-control" id="emailId" tabindex="1" type="email" required="true" />
</div>
</div>
<div class="form-group">
<label for="username" class="col-sm-2 control-label" style=" border-radius:0;color: #0E0E0E;">Phone No:</label>
<div class="col-sm-10">
<input type="text" name="phoneno" id="phoneno" class="form-control ip_text" tabindex="2" pattern="^([0-9]{10})?$" required="required" />
</div>
</div>
<button type="submit" class="btn btn-success btn-block">Submit Your Interest</button>
</form>
</div>
</div>
</div>
</div>
Hi its a very basic question i just want to know when hover on one element the style of other changes how can I achieve this ?
<form id="numerical" class="row">
<div class="form-group row">
<label>Enter Number :</label>
<input type="text" id="tel">
</div>
<div class="form-group row">
<label>Result :</label>
<input type="text" id="result">
</div>
<button type="submit" id="btn" class="row">Submit</button>
</form>
Like when i hover on button border-color of all the input changes.
I only want this with css no js or jQuery.
It is possible to do this but not with your current code.
Below is code of this working, the hover element will have to be before the elements you want to change. It works by going down and not up, so if this button is at the bottom you will not be able to see the same effect as the effect does not effect elements that are already rendered.
button:hover ~ div input {
border: 1px solid red;
}
<form id="numerical" class="row">
<button type="submit" id="btn" class="row">Submit</button>
<div class="form-group row">
<label>Enter Number :</label>
<input type="text" id="tel">
</div>
<div class="form-group row">
<label>Result :</label>
<input type="text" id="result">
</div>
</form>
We can select other elements siblings by using the ~ selector.
The ~ combinator separates two selectors and matches the second
element only if it is preceded by the first, and both share a common
parent.
More here
Here is the button at the bottom, as you can see it will not work.
button:hover ~ div input {
border: 1px solid red;
}
<form id="numerical" class="row">
<div class="form-group row">
<label>Enter Number :</label>
<input type="text" id="tel">
</div>
<div class="form-group row">
<label>Result :</label>
<input type="text" id="result">
</div>
<button type="submit" id="btn" class="row">Submit</button>
</form>
for a pure css solution you need to move the <button>-tag in front of the inputs you want to change, but then it'll work like this
button:hover ~ .form-group input {
border-color: red;
}
<form id="numerical" class="row">
<button type="submit" id="btn" class="row">Submit</button>
<div class="form-group row">
<label>Enter Number :</label>
<input type="text" id="tel">
</div>
<div class="form-group row">
<label>Result :</label>
<input type="text" id="result">
</div>
</form>
that is possible only if the inputs after the button
<form id="numerical" class="row">
<button type="submit" id="btn" class="row">Submit</button>
<div class="form-group row">
<label>Enter Number :</label>
<input type="text" id="tel">
</div>
<div class="form-group row">
<label>Result :</label>
<input type="text" id="result">
</div>
</form>
and the css:
#btn:hover ~ .form-group input {
background: #000;
}
after that you can use position absolute for the button
and this is demo
http://jsfiddle.net/u7tYE/6037/
try this
<form id="numerical" class="row">
<label for="btn" class="label"></label>
<div class="form-group row">
<label>Enter Number :</label>
<input type="text" id="tel">
</div>
<div class="form-group row">
<label>Result :</label>
<input type="text" id="result">
</div>
<button type="submit" id="btn" class="row">Submit</button>
</form>
<style>#numerical{
position: relative;
}
.form-group {
margin-bottom:10px;
}
#numerical .label {
position: absolute;
bottom: 0;
left: 0;
height: 32px;
width:102px;
}
.label:hover ~ .form-group input {
border: solid 2px red;
}
#btn{
background:blue;
color:#fff;
height:30px;
width:100px;
} </style>
Fiddle
I have a two input text
<form action="process.php" method="get">
Link <input placeholder="Link" type="text" name="c">
<p>
<br>
Password <input placeholder="Password Admin" type="text" name="p">
<p>
<br>
<input type="submit">
</form>
result:
How to align in this mode?
like this
Wrap your text inside label elements with divs, and your inputs into another set of divs. Easy to modify their stylings then:
<form action="process.php" method="get" id="yourform">
<div class="labels">
<label for="c">Link</label>
</div>
<div class="inputs">
<input placeholder="Link" type="text" name="c">
</div>
<div class="labels">
<label for="p">Password</label>
</div>
<div class="inputs">
<input placeholder="Password Admin" type="text" name="p">
</div>
<br>
<input type="submit">
</form>
CSS:
.labels {
width: 150px;
text-align: right;
float: left;
margin-right: 5px
}
See the demo - jsfiddle
completely frustrated here with something that is probably so simple. I have a form and want the Zip and Zip+4 fields to be on the same line. For some reason nothing is lining up the way I've done it. I've spent the last 6 hours searching the web and trying various things (this latest was from this site) and nothing works. Can someone help me please? Thanks!
Here is my code:
<form>
<div style="float:left;">
<label for "StrAddress">Street Address *</label>
<input name="StrAddress" type="text" style="width:200px" id="StrAddress" />
</div>
<div style="clear:both;"> </div>
<div style="float:left;">
<label for "StrSecondaryAddress">Suite, P.O. Box, Apt, Lot</label>
<input name="StrSecondaryAddress" type="text" style="width:200px" id="StrSecondaryAddress" />
</div>
<div style="clear:both;"> </div>
<div style="float:left;">
<label for "StrCity">City *</label>
<input name="StrCity" type="text" class="autosuggestinput" style="width:200px" id="StrCity" />
</div>
<div style="clear:both;"> </div>
<div style="float:left;">
<label for "subject">State</label>
<input type="text" class="input_text" name="subject" id="subject"/>
</div>
<div style="clear:both;"> </div>
<div style="display: inline;;">
<label for "IntZip5">Zip *</label>
<input name="IntZip5" type="text" style="width:100px" id="IntZip5" />
<label for "IntZip4">Zip+4</label>
<input type="text" name="IntZip4" id="IntZip4" style="width:50px">
</div>
<div style="clear:both;"> </div>
<div style="float:left;">
<label for "IntAmount">Taxable Amount</label>
<input type="text" name="IntAmount" id="IntAmount" style="width:150px">
</div>
<div style="clear:both;"> </div>
<input type="button" class="button" value="Submit Form" />
</form>
Would this do the job for you? Please test it on multiple browsers
because it's only tested on FF 3.6, IE 7+
While the structure police are sure to pull me over for this, it is my considered opinion that using a table is the single most reliable way to line up elements in all browsers. Set the vertical-align:top and do what you need to do.
You can do something along this lines:
<html>
<head>
<style type="text/css">
* { padding: 0; margin: 0;} /* do not use universal selector this is just for example */
label {
width: 300px !important;/* added important to override your inline styles*/
display: block !important;
text-align: right !important;
float: left;
}
</style>
</head>
<body>
<form>
<div style="float:left;">
<label for "StrAddress">Street Address *</label>
<input name="StrAddress" type="text" style="width:200px" id="StrAddress" />
</div>
<div style="clear:both;"> </div>
<div style="float:left;">
<label for "StrSecondaryAddress">Suite, P.O. Box, Apt, Lot</label>
<input name="StrSecondaryAddress" type="text" style="width:200px" id="StrSecondaryAddress" />
</div>
<div style="clear:both;"> </div>
<div style="float:left;">
<label for "StrCity">City *</label>
<input name="StrCity" type="text" class="autosuggestinput" style="width:200px" id="StrCity" />
</div>
<div style="clear:both;"> </div>
<div style="float:left;">
<label for "subject">State</label>
<input type="text" class="input_text" name="subject" id="subject"/>
</div>
<div style="clear:both;"> </div>
<div style="display: inline;;">
<label for "IntZip5">Zip *</label>
<input name="IntZip5" type="text" style="width:100px" id="IntZip5" />
<label for "IntZip4">Zip+4</label>
<input type="text" name="IntZip4" id="IntZip4" style="width:50px">
</div>
<div style="clear:both;"> </div>
<div style="float:left;">
<label for "IntAmount">Taxable Amount</label>
<input type="text" name="IntAmount" id="IntAmount" style="width:150px">
</div>
<div style="clear:both;"> </div>
<input type="button" class="button" value="Submit Form" />
</form>
</body>
</html>
The code you posted shows zip and zip+4 on the same line for me in Firefox, Chrome, and IE. Can you post a screen shot of how you see it differently and how you want it to look?