Working on converting some of the forms on our website to be housed within our new emailing platform (Pardot, a part of Salesforce). Using their CSS editor to create the forms, but I don't have much experience in CSS. I got all the labels for a checkbox to align vertically, but they're in a diagonal line instead of a vertical line. Any tips on how to fix that?
I also attached an image of what the form looks like on the website.
Here's the CSS:
pardot-form input[type="checkbox"] {
background-color: #fff;
color: #666;
font-family: "Open Sans", sans-serif;
font-size: 14px;
line-height: 1.75em;
height:18px;
width:18px;
padding:0;
margin-top:5px;
display:block;
float:left;
}
Will this work for you? I pulled some basic form elements from an existing Pardot form.
form.form input[type="checkbox"] {
background-color: #fff;
color: #666;
font-family: "Open Sans", sans-serif;
font-size: 14px;
line-height: 1.75em;
height: 18px;
width: 18px;
padding: 0;
margin-top: 5px;
display: inline;
}
<form class="form">
<p class="form-field company col-sm-12 Main_Alarm_Equipment_Used pd-checkbox required required-custom ">
<label class="field-label" for="1">Which mailing lists would you like to sign up for? (Check all that apply)*</label>
<span class="value"> <span>
<input type="checkbox" name="2" id="2" value="598212" onchange="">
<label class="inline" for="2">General Information</label>
</span> <span>
<input type="checkbox" name="3" id="3" value="598214" onchange="">
<label class="inline" for="3">Membership</label>
</span> <span>
<input type="checkbox" name="4" id="4" value="598216" onchange="">
<label class="inline" for="4">Alumni</label>
</span> <span>
<input type="checkbox" name="5" id="5" value="598218" onchange="">
<label class="inline" for="5">Show</label>
</span> <span>
<input type="checkbox" name="6" id="6" value="598220" onchange="">
<label class="inline" for="6">Band</label>
</span> </span> </p>
</form>
Related
so i need to style my form - i want the label to be inside of the field container as a place holder and i also want to stretch the input field containers but i am not winning:
<style>
.infusion-field-label-container {
font-size: 14px;
font-family: arial,sans-serif;
}
.infusion-field-input-container {
color: #000000;
font-size: 12px;
}
.infusion-option label {
color: #000000;
font-size: 14px;
font-family: arial,sans-serif;
}
</style>
<div align="center">
<div class="infusion-field">
<label for="inf_field_FirstName">First Name *</label>
<input class="infusion-field-input-container" id="inf_field_FirstName" name="inf_field_FirstName" type="text" />
<label for="inf_field_Phone1">Cell Number *</label>
<input class="infusion-field-input-container" id="inf_field_Phone1" name="inf_field_Phone1" type="text" />
<label for="inf_field_Email">Email *</label>
<input class="infusion-field-input-container" id="inf_field_Email" name="inf_field_Email" type="text" />
<input type="submit" value="Register" />
</div>
</div>
</form>
so i have most of it fixed:
<style>
.infusion-field-label-container {
font-size: 14px;
font-family: arial,sans-serif;
}
.infusion-field-input-container {
color: #000000;
font-size: 12px;
}
.infusion-option label {
color: #000000;
font-size: 14px;
font-family: arial,sans-serif;
}
</style>
<style type="text/css">
.infusion-field-label-container {
text-align:Left;
}
.infusion-field-input-container {
width:300px;
}
.infusion-field-label-container {
vertical-align:Middle;
}
</style>
<div align="center">
<div class="infusion-field">
<input class="infusion-field-input-container" id="inf_field_FirstName" name="inf_field_FirstName" type="text" placeholder="First Name*"/>
<input class="infusion-field-input-container" id="inf_field_Phone1" name="inf_field_Phone1" type="text" placeholder="Cell Number*" />
<input class="infusion-field-input-container" id="inf_field_Email" name="inf_field_Email" type="text" placeholder="Email*" />
<input type="submit" value="Register" />
</div>
</div>
</form>
Just cannot get the button styled - any hint please?
<!-- Main -->
<div id="main-wrapper">
<div class="container">
<div id="content">
<article>
<!-- Form Code Start -->
<form id='contactus' action='<?php echo $formproc->GetSelfScript(); ?>' method='post' accept-charset='UTF-8'>
<fieldset>
<legend>Contact us</legend>
<input type='hidden' name='submitted' id='submitted' value='1'/>
<input type='hidden' name='<?php echo $formproc->GetFormIDInputName(); ?>' value='<?php echo $formproc->GetFormIDInputValue(); ?>'/>
<input type='text2' class='spmhidip' name='<?php echo $formproc->GetSpamTrapInputName(); ?>' />
<div class='short_explanation'>* required fields</div>
<div>
<span class='error'>
<?php echo $formproc->GetErrorMessage(); ?>
</span>
</div>
<div class='container2'>
<label for='name' >Your Full Name*: </label><br/>
<input type='text2' name='name' id='name' value='<?php echo $formproc->SafeDisplay('name') ?>' maxlength="50" /><br/>
<span id='contactus_name_errorloc' class='error'></span>
</div>
<div class='container2'>
<label for='email' >Email Address*:</label><br/>
<input type='text2' name='email' id='email' value='<?php echo $formproc->SafeDisplay('email') ?>' maxlength="50" /><br/>
<span id='contactus_email_errorloc' class='error'></span>
</div>
<div class='container2'>
<label for='phone' >Phone Number:</label><br/>
<input type='text2' name='phone' id='phone' value='<?php echo $formproc->SafeDisplay('phone') ?>' maxlength="15" /><br/>
<span id='contactus_phone_errorloc' class='error'></span>
</div>
<div class='container2'>
<label for='query_type' >Regarding:</label><br/>
<select name='query_type'>
<option>Support</option>
<option>Request A Quote</option>
<option>Trouble uploading a file</option>
<option>Other</option>
</select>
<span id='contactus_email_errorloc' class='error'></span>
</div>
<div class='container2'>
<label for='message' >Message:</label><br/>
<span id='contactus_message_errorloc' class='error'></span>
<textarea rows="10" cols="50" name='message' id='message'><?php echo $formproc->SafeDisplay('message') ?></textarea>
</div>
<div class='container2'>
<div><img alt='Captcha image' src='show-captcha.php?rand=1' id='scaptcha_img' /></div>
<label for='scaptcha' >Enter the code above here:</label>
<input type='text2' name='scaptcha' id='scaptcha' maxlength="10" /><br/>
<span id='contactus_scaptcha_errorloc' class='error'></span>
<div class='short_explanation'>Can't read the image?
<a href='javascript: refresh_captcha_img();'>Click here to refresh</a>.</div>
</div>
<div class='container2'>
<input type='submit' name='Submit' value='Submit' />
</div>
</fieldset>
</form>
</article>
</div>
</div>
</div>
#contactus fieldset{
padding:20px;
border:1px solid #ccc;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
-khtml-border-radius: 10px;
border-radius: 10px;
margin:0 auto;
width:459px;
}
#contactus legend, h2{
font-family : Arial, sans-serif;
font-size: 1.3em;
font-weight:bold;
color:#333;
}
#contactus label2{
font-family : Arial, sans-serif;
font-size:0.8em;
font-weight: bold;
}
/* #contactus input[type="text2"], textarea{
font-family : Arial, Verdana, sans-serif;
font-size: 0.8em;
line-height:140%;
color : #000;
padding : 3px;
border : 1px solid #999;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-khtml-border-radius: 5px;
border-radius: 5px;
}
#contactus input[type="text2"]{
height:26px;
width:459px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
#contactus #scaptcha{
width:80px;
height:26px;
}
#contactus input[type="submit2"]{
width:100px;
height:30px;
padding-left:0px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
#contactus textarea2{
height:120px;
width:469px;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
}
#contactus input[type="text2"]:focus,textarea:focus{
color : #009;
border : 1px solid #0E0D0D;
background-color : #D1E7FF;
font-weight:bold;
}
#contactus .container2{
margin-top:8px;
margin-bottom: 10px;
}
#contactus .error{
font-family: Verdana, Arial, sans-serif;
font-size: 0.7em;
color: #900;
background-color : #FF8088;
}
#contactus fieldset#antispam{
padding:2px;
border-top:1px solid #EEE;
border-left:0;
border-right:0;
border-bottom:0;
width:350px;
}
#contactus fieldset#antispam legend{
font-family : Arial, sans-serif;
font-size: 0.8em;
font-weight:bold;
color:#333;
}
#contactus .short_explanation{
font-family : Arial, sans-serif;
font-size: 0.8em;
color:#333;
}
/* spam_trap: This input is hidden. This is here to trick the spam bots*/
#contactus .spmhidip{
display:none;
width:10px;
height:3px;
}
#fg_crdiv{
font-family : Arial, sans-serif;
font-size: 0.3em;
opacity: .2;
-moz-opacity: .2;
filter: alpha(opacity=20);
}
#fg_crdiv p{
display:none;
}
I've tried everything, I can't figure out what is affecting the form to cause it to run off the screen on a mobile device. Here is the link to the form.
in main.css you have hard-coded some widths for example width of input fields, width of fieldset. Just remove them or make them in percentage and your page will become responsive
It is hard to tell from the snippet but when the following code is placed in the document inspector it seems to work
Your hard coded widths were causing the issue, you may have to also modify your other media queries and break points to get it working at every size
#media screen and (max-width: 736px){
body, input, select, textarea {
line-height: 2em;
width: 100%;
}
#contactus input[type="text2"] {
height: 26px;
width: 100%;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
}
<link rel="stylesheet prefetch" href="https://www.munroprinting.com/assets/css/main.css">
<div class="container">
<div id="content">
<article>
<!-- Form Code Start -->
<form id="contactus" action="/upload/contactform.php" method="post" accept-charset="UTF-8">
<fieldset>
<legend>Contact us</legend>
<input type="hidden" name="submitted" id="submitted" value="1">
<input type="hidden" name="id3a31ca8adb123c3ea7b9" value="432ce4949a45b03c0299f37b81305012">
<input type="text2" class="spmhidip" name="sp5d7f1e2089582b5699eab58b16dad351">
<div class="short_explanation">* required fields</div>
<div><span class="error"></span></div>
<div class="container2">
<label for="name">Your Full Name*: </label><br>
<input type="text2" name="name" id="name" value="" maxlength="50" style="background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABHklEQVQ4EaVTO26DQBD1ohQWaS2lg9JybZ+AK7hNwx2oIoVf4UPQ0Lj1FdKktevIpel8AKNUkDcWMxpgSaIEaTVv3sx7uztiTdu2s/98DywOw3Dued4Who/M2aIx5lZV1aEsy0+qiwHELyi+Ytl0PQ69SxAxkWIA4RMRTdNsKE59juMcuZd6xIAFeZ6fGCdJ8kY4y7KAuTRNGd7jyEBXsdOPE3a0QGPsniOnnYMO67LgSQN9T41F2QGrQRRFCwyzoIF2qyBuKKbcOgPXdVeY9rMWgNsjf9ccYesJhk3f5dYT1HX9gR0LLQR30TnjkUEcx2uIuS4RnI+aj6sJR0AM8AaumPaM/rRehyWhXqbFAA9kh3/8/NvHxAYGAsZ/il8IalkCLBfNVAAAAABJRU5ErkJggg=="); background-repeat: no-repeat; background-attachment: scroll; background-size: 16px 18px; background-position: 98% 50%;"><br>
<span id="contactus_name_errorloc" class="error"></span>
</div>
<div class="container2">
<label for="email">Email Address*:</label><br>
<input type="text2" name="email" id="email" value="" maxlength="50"><br>
<span id="contactus_email_errorloc" class="error"></span>
</div>
<div class="container2">
<label for="phone">Phone Number:</label><br>
<input type="text2" name="phone" id="phone" value="" maxlength="15"><br>
<span id="contactus_phone_errorloc" class="error"></span>
</div>
<div class="container2">
<label for="query_type">Regarding:</label><br>
<select name="query_type">
<option>Support</option>
<option>Request A Quote</option>
<option>Trouble uploading a file</option>
<option>Other</option>
</select>
<span id="contactus_email_errorloc" class="error"></span>
</div>
<div class="container2">
<label for="message">Message:</label><br>
<span id="contactus_message_errorloc" class="error"></span>
<textarea rows="10" cols="50" name="message" id="message"></textarea>
</div>
<div class="container2">
<div><img alt="Captcha image" src="show-captcha.php?rand=1" id="scaptcha_img"></div>
<label for="scaptcha">Enter the code above here:</label>
<input type="text2" name="scaptcha" id="scaptcha" maxlength="10"><br>
<span id="contactus_scaptcha_errorloc" class="error"></span>
<div class="short_explanation">Can't read the image?
Click here to refresh.</div>
</div>
<div class="container2">
<input type="submit" name="Submit" value="Submit">
</div>
</fieldset>
</form>
</article>
</div>
</div>
how to use css for positioning my checkboxes in lines let's say of 4. For now the're displaying all in one line.
I tried with floating left and margin but it's not working the way I do it.
I have 7 groups of lists like below in my form
HTML:
<div class="Oobj" id="Oobj60">
<form action="mailto:kontakt#2know.pl" method="post" enctype="text/plain">
<div id="Oobj58">
<input type="checkbox" onClick="toggle(this)" /><br>
<input type="checkbox" name="sport" value="fitness" />fitness<br />
<input type="checkbox" name="sport" value="gym" />siłownia<br />
<input type="checkbox" name="sport" value="siata" />siatkówka<br />
<input type="checkbox" name="sport" value="noga" />piłka nożna<br />
<input type="checkbox" name="sport" value="kosz" />koszykówka<br />
<input type="checkbox" name="sport" value="zima" />sporty zimowe<br />
</div>
</form> </div>
CSS:
#Oobj58 {
position: absolute;
font-size: 13px;
font-family: Open Sans;
z-index: 43;
text-align: left;
left: 12.25em;
top: 23.00em;
display: none;
}
class 'Oobj' is empty. I needed it for another jq code.
try this
<div class="Oobj" id="Oobj60">
<form action="mailto:kontakt#2know.pl" method="post" enctype="text/plain">
<div id="Oobj58">
<ul>
<li> <input type="checkbox" name="sport" value="fitness" />fitness </li>
<li> <input type="checkbox" name="sport" value="gym" />siłownia</li>
<li> <input type="checkbox" name="sport" value="siata" />siatkówka</li>
<li> <input type="checkbox" name="sport" value="noga" />piłka nożna</li>
<li> <input type="checkbox" name="sport" value="kosz" />koszykówka</li>
<li> <input type="checkbox" name="sport" value="zima" />sporty zimowe</li>
</ul>
</div>
</form> </div>
#Oobj58 {
font-size: 13px;
font-family: Open Sans;
text-align: left;
left: 12.25em;
top: 23.00em;
}
#Oobj58 ul li { display:inline; margin-left:10px; }
Hi I am looking to design CSS for html pages and below is m problem. I have two text boxes side by side put in an inline container.
I am now validating the inputs and want to display the error message exactly above the respective text box. So, I have created spans and put them in an inline-container of lesser height and thought of displaying. But the problem is:
Case-1:
The validation message for the second text box shifts left if the length of the error message is short. How do I avoid this?
Case-2:
If the validation message for input text box 1 is long, it is making the error message of text box 2 to shift extreme right. In this case, I want the validation message of text box 1 to be in multiple lines above the area of text box 1
MY HTML:
<div class="inline-container1">
<ul><li><span class="validationMessage"
data-bind="validationMessage: firstName" /></li>
<li><span class="validationMessage"
data-bind="validationMessage: lastName" /></li>
</ul>
</div>
<div id="name" class="inline-container">
<ul>
<li> <input id="firstName"
name="firstName" type="text" class="required-input"
placeholder="First Name *" data-bind="value: firstName" />
</li>
<li> <input id="lastName"
name="lastName" type="text" class="required-input"
placeholder="Last Name *" data-bind="value: lastName" />
</li>
</ul>
</div>
MY CSS:
.inline-container1 ul li{
display: inline;
list-style-type: none;
padding-right: 20px;
min-height: 10px;
margin: 0;
width: 230px;
}
.inline-container1 {
}
.inline-container1 ul
{
list-style-position: outside;
list-style-type: none;
padding: 0;
margin: 0;
}
.validationMessage {
font-family: Arial, sans-serif;
font-size: 12px;
color: #F00;
display: inline;
}
Here is a Fiddle i created to help -> http://jsfiddle.net/Moje/dTvKM/
Fullscreen -> http://jsfiddle.net/Moje/dTvKM/embedded/result/
HTML:
<div class="ctnr">
<span class="vMsg" data-bind="validationMessage: firstName">Val. msg for txtbox 1</span>
<span class="vMsg" data-bind="validationMessage: lastName" >Val. msg for txtbox 2</span>
</div>
<div class="ctnr">
<input id="firstName" name="firstName" type="text" class="required-input" placeholder="First Name *"
data-bind="value: firstName" />
<input id="lastName" name="lastName" type="text" class="required-input" placeholder="Last Name *"
data-bind="value: lastName" />
</div>
CSS:
body{font-family:sans;}
.ctnr > *{ display: inline-block; width: 40%;}
.vMsg{
display:relative;
top:-40px;
border:1px solid red;
color:red;
padding:2px;
}
input[type=text]{-webkit-appearance:none;outline:none;border:none;}
#firstName{border:3px solid black;}
#lastName{border:3px solid red;}
You can tweak it further to suit your needs.
trying to get the nth-child/first-child working
on the first label within the form below
but can't get it right
At the moment I'm using
form label {
display: block;
font-size: 20px;
font-size: 2rem;
line-height: 18px;
cursor: pointer;
margin:0 auto;
color:#FFF;
text-transform:uppercase;
padding:40px 0 10px;
font-weight: normal!important;
}
label:first-child {
padding-top:0;
}
but have used
form code div.field span.lspan label:nth-of-type(1)
form code div.field span.lspan label:first-child
.lspan label:first-child
form label:first-child
they set all labels in the form to padding 0
<form method="POST" action="" class="">
<div class="field">
<span class="lspan"><label for="sender_name">Name</label></span>
<span class="inspan"><input class="hinput" type="text" name="sender_name" value=""></span>
</div>
<div class="field">
<span class="lspan"><label for="sender_name">Email</label></span><span class="inspan"> <input class="hinput" type="text" name="email" value=""> </span></div>
<div class="field">
<span class="lspan"><label for="subject">Subject</label></span><span class="inspan"><input class="hinput" type="text" name="subject" value=""></span></div>
<div class="field">
<span class="lspan"><label for="sender_name">Message</label></span><span class="inspan"> <textarea class="htextarea" name="message"></textarea></span></div>
<div class="field">
</div>
<div class="field" style="margin-top:15px">
<input type = "submit" class="csubmit" name = "submit" value="Submit" style="" />
</div>
</form>
Thanks
Roy
All the <label> tags in your code are a first-child of their respective <span> element.
If you only want to target the first appearance of a <label> in your code use this:
form div:first-child label {
padding: 0;
}
This will target any label within the <div> element, that is the first-child of the form.
Remember, that you can use :first-child on any subselektor and not just on the outermost right!