I use contact form 7.
The html code from form:
<div class="clearfix">
<div id="left">
First name [text first-name]<br/>
Last name [text last-name]<br/>
How Did You Find Us? [text text-find-us]
</div>
<div id="right">
Email [email* your-email] <br/>
Phone [text your-phone]
</div>
</div>
Subject [text* your-subject] <br/>
Message [textarea* your-message]<br/>
[submit "Send"]
How can I put the "First name" to be in the same line with the box of box text in which user type his/her first name?
Not sure how Contact Form 7 renders html with those tags which are inside brackets. You could possibly use CSS/HTML to position the items.
HTML:
<div class="clearfix">
<div id="left">
<span class="label">First name</span><span class="form-input">[text first-name]</span><br/>
<span class="label">Last name</span><span class="form-input">[text last-name]</span><br/>
<span class="label">How Did You Find Us?</span><span class="form-input">[text text-find-us]</span>
</div>
<div id="right">
<span class="label">Email</span><span class="form-input">[email* your-email]</span><br/>
<span class="label">Phone</span><span class="form-input">[text your-phone]</span>
</div>
</div>
CSS:
div#left {
float: left;
width: 400px;
}
div#right {
float:left;
width: 400px;
}
span.label {
float: left;
width: 180px;
}
span.form-input {
float: left;
width: 200px;
}
Fiddle: https://jsfiddle.net/mediaguru/f1e68999/
Related
I am creating a form using css and having issues with alignment for certain fields. This layout consists of multiple columns
The issues are as follows
The two checkboxes are appearing next to each other , instead of one below the other
The second column should appear close to the first column, not able to remove the whitespace, should I set the col width for each column ?
the html code seems cumbersome, since each column needs to contain the fields based on the required fields, not sure if I am using correct approach , new to css
body {
margin: 0;
padding: 0;
box-sizing: border-box;
}
h1 {
text-align: center;
}
.container1 {
display: flex;
flex-direction: row;
margin: 10px 50px 10px
}
.container2 {
display: flex;
justify-content: center;
}
.col1 {
flex: 1
}
.col2 {
flex: 1;
align-items: start
}
.button-basic {
border: 1px solid black;
border-radius: 5px;
margin: 10px;
padding: 10px
<body>
<h1> Employee information </h1>
<form>
<div class="container1">
<div class="col1">
<p> Employee id:</p>
<p> Employee Type:</p>
<p> Employee Status: </p>
<p> Promotion Flag:</p>
<p> Insurance Flag:</p>
</div>
<div class="col2">
<p id="employee-id"> 12345 </p>
<p id="employee-type"> HR </p>
<p id="employee-status"> Active </p>
<input type="checkbox" id="promotion-flag" name="promotion-flag">
<input type="checkbox" id="insurance-flag" name="insurance-flag">
</div>
<div class="col1">
<p> Employee First Name: </p>
<p> Description: </p>
<p> Description: </p>
<p> Promotion comments: </p>
</div>
<div class="col2">
<p id="employee-fname"> John </p>
<p id="employee-type-desc"> HR employee </p>
<p id="employee-status-desc"> Active employee </p>
<input type="text" id="promotion-reason" name="promotion-reason">
</div>
<div class="col1">
<p> Employee Last Name: </p>
<p> Employee Start Date: </p>
</div>
<div class="col2">
<p id="employee-lname"> Smith </p>
<p id="employee-start-date"> 01/01/2020 </p>
</div>
</div>
<div class="container2">
<input class="button-basic" type="submit" value="Search">
<input class="button-basic" type="submit" value="Save">
</div>
</form>
you need to give the page a purpose with design
try for getting rid of the spaces
.col1 {
flex: 1;
text-align: right;
}
.col2 {
flex: 1;
text-align: left;
}
also.. learn about the box model for getting the gaps prettier
with the checkboxes you just need to add a <br>
...
<div class="col2">
<p id="employee-id"> 12345 </p>
<p id="employee-type"> HR </p>
<p id="employee-status"> Active </p>
<input type="checkbox" id="promotion-flag" name="promotion-flag"><br>
<input type="checkbox" id="insurance-flag" name="insurance-flag">
</div>
...
consider to use a table instead of wiring a bunch of divs
Trying to create a layout that has two columns, and text between those columns
Something like this:
But I am running into spacing issues with twitter bootstrap to make it actually work. On top of making these items the same width with the text between, they should all be vertically aligned.
You can do that using 3 columns
Live Demo jsfiddle
<div class="container-fluid">
<div class="row">
<div class="col-xs-6">.col-sm-6</div>
<div class="col-xs-6">.col-sm-6</div>
</div>
<br/>
<p>Create an account...............................</p>
<div class="row">
<div class="col-xs-6 test" >
<form class="form-horizontal vmid" role="form">
<div class="form-group">
<label class="control-label col-sm-2" for="email">Email:</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="email" placeholder="Enter email"/>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="pwd">Password:</label>
<div class="col-sm-10">
<input type="password" class="form-control" id="pwd" placeholder="Enter password"/>
</div>
</div></form>
</div>
<div class="col-xs-1 test" >
<p class="asd"> ~OR~</p>
</div>
<div class="col-xs-5 test" >
<button type="submit" class="asd btn-primary btn-lg">Facebook</button>
</div>
</div>
</div>
Style
.vmid{
position:relative;
top:50%;
transform:translateY(-50%);
}
.asd{
position:relative;
top:50%;
transform:translateY(-35%);
}
This is not a bootstrap answer just a plain simple CSS one. Although you can adapt it to bootstrap easily because the basic underlying principle is the same. Instead of using width percentages that I have used in my example, bootstrap grid system columns can be used instead. Saying all that, you can achieve your desired effect by dividing the wrapper div into 3 columns and then using the display table for parent and table-cell and vertical align middle for the child to place the respective input elements and button elements in its place as needed.
The fiddle can be found here
The code snippet follows...
.wrapper {
height: 300px;
width: 100%;
background: pink;
}
.leftSide,
.rightSide,
.midPart {
box-sizing: border-box;
height: 100%;
display: table;
}
.leftSide {
width: 45%;
background: lightgray;
float: left;
}
.midPart {
width: 10%;
background: aqua;
}
.midPart p {
display: table-cell;
vertical-align: middle;
text-align: center;
}
.leftSide div,
.rightSide div {
display: table-cell;
vertical-align: middle;
text-align: center;
}
.rightSide {
width: 45%;
background: lightcyan;
float: right;
}
button {
height: 3em;
width: 100px;
background: blue;
color: white;
}
<div class="wrapper">
<div class="leftSide">
<div>
<input placeholder="Enter Username" />
<br/>
<br/>
<input placeholder="Enter password" />
</div>
</div>
<div class="rightSide">
<div>
<button>Hello</button>
</div>
</div>
<div class="midPart">
<p>-or-</p>
</div>
</div>
Hope this helps. Happy coding :)
Update::
***Another updated Fiddle without colors***
I have a need to get the TextBoxesGroup scrolling under the image on the top if the visitors scroll up or under the Add to basket in the footer if the visitors scroll down.
My footer add-to-wrap is pretty much fixed but the problem is that the div will not scroll undless it goes well under the footer and then when I scroll the add-to-wrap div also scrolls.
What am I doing wrong?
<style>
.wrong_email{
display:none;
color:red;
}
.add-to-wrap {
width: 100%;
display: block;
position: fixed;
bottom: 0;
margin: 0 auto;
text-align: center;
background-color: rgba(0,0,0,0.6);
padding: 10px 0 10px 0;
z-index: 3;
}
</style>
<div class="container">
<div class="row">
<div class="col-md-4" style="padding-left:0px; padding-right:0px;">
<img src="/brand/nvite.png" class="img-responsive"/>
</div>
<div>
<form method="POST" id="login_form">
<div id='TextBoxesGroup' class="textboxes-area">
<div id="TextBoxDiv1">
<input type='text' id='textbox1' name='textbox_1' class="form-control" placeholder="Enter email address here"/>
</div>
<div class="wrong_email" id="err_1">Wrong email address</div>
<div class="divider"><img src="/mobileimages/brand_takeovers/divider_invite.png" class="img-responsive"/></div>
<div id="TextBoxDiv2">
<input type='text' id='textbox2' name='textbox_2' class="form-control" placeholder="Enter email address here"/>
</div>
<div class="wrong_email" id="err_2">Wrong email address</div>
<div class="divider"><img src="/mobileimages/brand_takeovers/divider_invite.png" class="img-responsive"/></div>
<div id="TextBoxDiv3">
<input type='text' id='textbox3' name='textbox_3' class="form-control" placeholder="Enter email address here"/>
</div>
<div class="wrong_email" id="err_3" >Wrong email address</div>
</div>
<span id='addButton' class="send-invite-more-boxes "/><img src="invitemore.png" class="img-responsive"/></span>
</div>
</div>
</div> <!-- /container -->
<div class="add-to-wrap">
<button type="submit" class="send-invite-button">Add To Basket</button>
</div>
</form>
I have a couple of different issues.
I have a div with a couple of other divs and some controls in it. My biggest issue is that it does not look the same in Chrome as it does in other browsers. As it is right now, it looks as following:
And the biggest issue is with Chrome, where the textbox to the right of the "width:" text goes down onto the next line. The code for the box can be seen in this JSFiddle or as as following:
<div id="div_properties" class="redBorder left" style="clear: left; display:
<div class="right">
<a href="#" id="closePropertiesWindow">
<img src="close.png" title="Close window"></a>
</div>
<div class="centered noMargin whiteBackground">
<h3 class="noMargin">Properties</h3>
</div>
<hr class="noMargin noPadding">
<div id="div_properties_content" style="display: block;">
<div class="noMargin propertiesControl" prop="text" style="width:100%;">
text:
<input type="text" id="propertytextTextBox" class="right"></input>
</div>
<div class="noMargin propertiesControl" prop="width" style="width:100%;">
width:
<input type="number" id="propertywidthNumber" class="right"></input>
</div>
<div class="noMargin propertiesControl" prop="italic" style="width:100%;">
italic:
<input type="checkbox" id="propertyitalicCheckBox" class="right" checked="checked">
</div>
<div class="noMargin propertiesControl" prop="bold" style="width:100%;">
bold:
<input type="checkbox" id="propertyboldCheckBox" class="right">
</div>
<br>
<input type="button" id="savePropertiesButton" value="Save" class="right">
</div>
</div>
And the CSS is as following:
#div_properties {
margin-top: 5px;
background-color: #F0F0F0;
width: 300px;
float: left;
min-height: 75px;
}
.redBorder {
border: 1px solid red;
}
.noMargin {
margin: 0 0 0 0;
}
.left {
float: left;
}
.right {
float: right;
}
(Those are all the related classes in this scope, the other classes defined on the items have no styles, but are being used in the JavaScript.)
Also, another issue I'm having is the "box border" around the close-image in IE. This is not a big issue, but if anyone knows what is causing it, it would be fantastic.
Its the floating that's causing the issue. You need to clear them.
.propertiesControl {
clear:both;
}
http://jsfiddle.net/JWDkM/2/
I have looked at every possible answers on this subject and for the life of me, cannot get it done.
On this page http://dev.rpgplan.com/contact-us/ I am trying to line up the top 3 fields like this image http://note.io/13eOJi7
but all I am getting is misaligned fields.
In the page you used <br></br> tag between 3 input fields that cause lineBreak so here is what i change and think solve your problem
<div class="wpcf7" id="wpcf7-f352-p353-o1"><form action="/contact-us/#wpcf7-f352-p353-o1" method="post" class="wpcf7-form" novalidate="novalidate">
<div style="display: none;">
...
</div>
<div id="inner-contact">
<span class="wpcf7-form-control-wrap first-name">
<input name="first-name" ... " type="text">
</span>
**[Omit <br></br>]**
<span class="wpcf7-form-control-wrap last-name">
<input name="last-name" ... type="text">
</span>
**[Omit <br></br>]**
<span class="wpcf7-form-control-wrap email">
<input name="email" ... type="email">
</span>
</div>
...
</div>
</form>
</div>
Also i see your first 2 field has margin-top: 6px; and margin-bottom: 20px; property but 3rd field has margin-top: 3px; and margin-bottom: 10px;!
so fix 3rd field's property like two other field and it will be ok.
maybe this will help,
jsFiddle
.small{
border:1px solid black;
float:left;
height:20px;
width:50px;
margin-right:20px;
}
.big
{
border:1px solid black;
float:left;
clear:left;
height:200px;
width:194px;
margin-top:20px;
}
<div>
<div class="small"></div>
<div class="small"></div>
<div class="small"></div>
<div class="big"></div>
</div>