Problems with a from CSS - css

I am trying to create a fairly basic form with in my maincontent. I am sure I am coding things incorrectly and it is driving me crazy. Note my code. I get extremely wide vertical spacing in IE 7 and the bacground color between the field sets does not work correctly. All is good in FF.
My CSS is:
fieldset {
margin: 1.5em 0 0 0;
padding: 0;
border-style: none;
border-top: 1px solid #BFBAB0;
background-color: #FFFFFF;
}
legend {
margin-left: 1em;
color: #000000;
font-weight: bold;
}
fieldset ol {
padding: 1em 1em 0 1em;
list-style: none;
}
fieldset li {
padding-bottom: 1em;
}
fieldset.submit {
border-style: none;
}
{
var w = document.myform.mylist.selectedIndex;
var selected_text = document.myform.mylist.options[w].text;
alert(selected_text);
}
label em {
display: block;
color: #900;
font-size: 85%;
font-style: normal;
text-transform: uppercase;
}
This is my html code.
<div id="mainContent1">
<form name="myform">
<label for="mylist"><strong>Select an Account Type:</strong></label>
<select name="mylist"><option value="traditional">Traditional Account</option>
<option value="paperless">Paperless Account</option>
</select>
</form>
<br /><a> </a>
<form action="example.php">
<fieldset>
<legend>Contact Details</legend>
<ol>
<li>
<label for="name">Name:</label>
<input id="name" name="name" class="text" type="text" />
<label for="name">
<em>required</em>
</label>
</li>
<li>
<label for="email">Email address:</label>
<input id="email" name="email" class="text" type="text" />
<label for="name">
<em>required</em>
</li>
<li>
<label for="phone">Telephone:</label>
<input id="phone" name="phone" class="text" type="text" />
<label for="name">
<em>required</em>
<ol>
<li>
<input id="option1" name="option1"
class="checkbox" type="checkbox" value="1" />
<label for="option1">Savings</label>
</li>
<li>
<input id="option2" name="option2"
class="checkbox" type="checkbox" value="1" />
<label for="option2">Checkings</label>
</li>
</ol>
</fieldset>
<fieldset>
<legend>Delivery Address</legend>
<ol>
<li>
<label for="address1">Address 1:</label>
<input id="address1" name="address1" class="text"
type="text" />
</li>
<li>
<label for="city">City:</label>
<input id="city" name="city" class="text" type="text" />
</li>
<li>
<label for="postcode">Zip Code:</label>
<input id="postcode" name="postcode"
class="text textSmall" type="text" />
</li>
<li>
<label for="country">Country:</label>
<input id="country" name="country" class="text" type="text" />
</li>
</ol>
</fieldset>
<fieldset class="submit">
<input class="submit" type="submit" value="Submit" />
</fieldset>
<fieldset class="clear">
<input class="clear" type="clear"
value="Submit" />
</fieldset>
</form>

First, get rid of the script in your CSS file...
Firefox/compliant browsers and IE treat legends and fieldsets very differently, unfortunately... that may be the problem you're seeing:
http://www.456bereastreet.com/lab/styling-form-controls-revisited/fieldset/

make sure there is a "#" before your id's and a "." before your classes in your css file. not doing so causes confusion.

Related

How to make multiple selection in Contact Form 7 with images?

I need to do the same as here:
http://deinehelfer24.de/renovierungen/
As I understand it, this is done on contact form 7, but how are the images and multiple selections implemented?
I feel generous today, simpe example ho you can style labels
https://jsfiddle.net/Beneris/65mdtpo3/28/
HTML
<form>
<div class="input-group">
<div class="input-wrap">
<input type="radio" name="group1" id="group1-1" value="1">
<label for="group1-1">
<figure><img src="http://placekitten.com/g/100/100"><h3>Radio 1</h3></figure>
</label>
</div>
<div class="input-wrap">
<input type="radio" name="group1" id="group1-2" value="2">
<label for="group1-2">
<figure><img src="http://placekitten.com/g/100/100"><h3>Radio 2</h3></figure>
</label>
</div>
<div class="input-wrap">
<input type="radio" name="group1" id="group1-3" value="3">
<label for="group1-3">
<figure><img src="http://placekitten.com/g/100/100"><h3>Radio 3</h3></figure>
</label>
</div>
</div>
<div class="input-group">
<div class="input-wrap to-toggle 1 3">
<input type="checkbox" name="group2" id="group2-1" value="1">
<label for="group2-1">
<figure><img src="http://placekitten.com/g/100/100"><h3>checkbox 1</h3></figure>
</label>
</div>
<div class="input-wrap to-toggle 1 2">
<input type="checkbox" name="group2" id="group2-2" value="2">
<label for="group2-2">
<figure><img src="http://placekitten.com/g/100/100"><h3>checkbox 2</h3></figure>
</label>
</div>
<div class="input-wrap to-toggle 1 2 3">
<input type="checkbox" name="group2" id="group2-3" value="3">
<label for="group2-3">
<figure><img src="http://placekitten.com/g/100/100"><h3>checkbox 3</h3></figure>
</label>
</div>
</div>
</form>
CSS
.radio-group {
display:block;
}
.input-group .input-wrap{
display:inline-block;
vertical-align: top;
padding: 10px;
}
label figure {
background-color: #ccc;
padding: 5px 10px;
border-radius: 0 0 5px 5px;
cursor: pointer;
}
figure h3 {
text-align: center;
}
.input-group input:checked ~ label figure {
background-color: red;
}
.input-wrap input {
display:none;
}
JS
$('.to-toggle').hide();
$('input[name=group1]').on('change', function(){
var val = $(this).val();
$('.to-toggle').hide();
$('.to-toggle input').prop('checked', false);
$('.to-toggle.' + val).show();
//alert(val);
});

How to apply zoom transition on label and textbox simultaneously in HTML/CSS?

I tried form in HTML and I want to hover zoom transition on label and text box at same time, like if I put a cursor on label then label and text box both zoomed. I tried many codes and YouTube. I can hover both separately but I don't know how to zoom at same time.can anyone have any coding idea.
this is html code : and above is css code plz check both codes because i want to hover simultaneously if i active cursor on label then both label and text area will be zoomed
i tried many option but i failed to get answer .if anyone helps me because its my college assignment and i am stuck with it badly please i want it fast answer
label {
transform: 56px;
font-width: 180px;
display: inline-block;
text-align: right;
text-align: top;
}
label:hover {
font-size: 40px;
}
input:hover {
font-size: 40px;
}
#preview {
margin-top: 8.5px;
margin-left: 5px;
width: 20%;
}
fieldset {
background-color: lightyellow;
border: 10px solid yellow;
margin-bottom: 10px;
width: 600px height: 900px;
}
<form>
<h1>PLEASE ENTER YOUR DETAIL FOR OUR DATING SITE</h1>
<fieldset>
<legend>YOUR FACE</legend>
<label>YOUR IMAGE</label>
<input type="file" id="avatar" name="avatar" required>
<br>
<label>image preview:</label>
<img id="preview">
</fieldset>
<fieldset>
<legend>YOUR GENERAL DETAIL</legend>
<label>NAME</label>
<input type="text" name="name">
<br>
<br>
<label>Gender</label>
: Male
<input type="radio" width="180px">Female
<input type="radio">
<br>
<br>
<label>Age:</label>
<input type="number" width="180px">
<br>
<br>
<label>Date of birth:</label>
<input type="date" width="180px">
<br>
<br>
<label>Favourite color:</label>
<input type="color" width="180px">
<br>
<br>
<label>Which country:</label>
<select required width="180px">
<br>
<option value="">None</option>
<option>America</option>
<option>Pakistan</option>
<option>Egypt</option>
<option>Turkey</option>
<option>China</option>
<option>Japan</option>
<br>
</select>
</fieldset>
<fieldset>
<legend>Your indicators</legend>
<br>
<label>Height:</label>
Short
<input type="range" min="0" max="100" ;>Tall
<br>
<br>
<label>Salary:Poor</label>
<input type="range" min="0" max="100">Rich
<br>
</fieldset>
<fieldset>
<legend>Your Contact Information</legend>
<label>Email:</label>
<input type="email" style="width:180;">
<br>
<br>
<label>Mobile:</label>
<input type="tel " width="180px ">
<br>
<br>
<label>Address:</label>
<textarea></textarea>
<br>
<br>
<label>Method to contact you:</label>
<input type="checkbox " ; width="auto ">
<label>Email</label>
<input type="checkbox ">
<label>Whatsapp</label>
<input type="checkbox ">
<label>In-appchat</label>
<input type="checkbox ">
</fieldset>
<input type="submit " value="Submit ">
<script src="https://www.cse.ust.hk/~rossiter/dating_web_site.js "></script>
</form>
Simply wrap the <label> around the <input>.
<label>TEXT
<input>
</label>
SNIPPET
label {
transform: 56px;
width: 180px;
display: inline-block;
text-align: right;
text-align: top;
}
label:hover, label:focus {
font-size: 40px;
}
input:hover, label:focus {
font-size: 40px;
}
#preview {
margin-top: 8.5px;
margin-left: 5px;
width: 20%;
}
fieldset {
background-color: lightyellow;
border: 10px solid yellow;
margin-bottom: 10px;
width: 600px height: 900px;
}
<form>
<h1>PLEASE ENTER YOUR DETAIL FOR OUR DATING SITE</h1>
<fieldset>
<legend>YOUR FACE</legend>
<label>YOUR IMAGE
<input type="file" id="avatar" name="avatar" required>
</label>
<br>
<label>image preview:</label>
<img id="preview">
</fieldset>
<fieldset>
<legend>YOUR GENERAL DETAIL</legend>
<label>NAME
<input type="text" name="name">
</label>
<br>
<br>
<label>Gender : Male
<input type="radio">
</label>
<label>
Female
<input type="radio">
</label>
<br>
<br>
<label>Age:
<input type="number" width="180px">
</label>
<br>
<br>
<label>Date of birth:
<input type="date" width="180px">
</label>
<br>
<br>
<label>Favourite color:
<input type="color" width="180px">
</label>
<br>
<br>
<label>Which country:
<select required width="180px">
<br>
<option value="">None</option>
<option>America</option>
<option>Pakistan</option>
<option>Egypt</option>
<option>Turkey</option>
<option>China</option>
<option>Japan</option>
<br>
</select>
</label>
</fieldset>
<fieldset>
<legend>Your indicators</legend>
<br>
<label>Height:
Short
<input type="range" min="0" max="100" ;>Tall</label>
<br>
<br>
<label>Salary:Poor
<input type="range" min="0" max="100">Rich</label>
<br>
</fieldset>
<fieldset>
<legend>Your Contact Information</legend>
<label>Email:
<input type="email" style="width:180;">
</label>
<br>
<br>
<label>Mobile:
<input type="tel " width="180px ">
</label>
<br>
<br>
<label>Address:</label>
<textarea></textarea>
<br>
<br>
<label>Method to contact you:
<input type="checkbox " width="auto">
</label>
<label>Email
<input type="checkbox ">
</label>
<label>Whatsapp
<input type="checkbox ">
</label>
<label>In-appchat
<input type="checkbox ">
</label>
</fieldset>
<input type="submit " value="Submit ">
<script src="https://www.cse.ust.hk/~rossiter/dating_web_site.js "></script>
</form>
Use the Adjacent sibling combinator to choose the input next to the hovered label.
label {
transform: 56px;
font-width: 180px;
display: inline-block;
text-align: right;
text-align: top;
}
label:hover, label:hover + input, label:hover + select, label:hover + textarea {
font-size: 40px;
}
#preview {
margin-top: 8.5px;
margin-left: 5px;
width: 20%;
}
fieldset {
background-color: lightyellow;
border: 10px solid yellow;
margin-bottom: 10px;
width: 600px height: 900px;
}
<form>
<h1>PLEASE ENTER YOUR DETAIL FOR OUR DATING SITE</h1>
<fieldset>
<legend>YOUR FACE</legend>
<label>YOUR IMAGE</label>
<input type="file" id="avatar" name="avatar" required>
<br>
<label>image preview:</label>
<img id="preview">
</fieldset>
<fieldset>
<legend>YOUR GENERAL DETAIL</legend>
<label>NAME</label>
<input type="text" name="name">
<br>
<br>
<label>Gender</label>
: Male
<input type="radio" width="180px">Female
<input type="radio">
<br>
<br>
<label>Age:</label>
<input type="number" width="180px">
<br>
<br>
<label>Date of birth:</label>
<input type="date" width="180px">
<br>
<br>
<label>Favourite color:</label>
<input type="color" width="180px">
<br>
<br>
<label>Which country:</label>
<select required width="180px">
<br>
<option value="">None</option>
<option>America</option>
<option>Pakistan</option>
<option>Egypt</option>
<option>Turkey</option>
<option>China</option>
<option>Japan</option>
<br>
</select>
</fieldset>
<fieldset>
<legend>Your indicators</legend>
<br>
<label>Height:</label>
Short
<input type="range" min="0" max="100" ;>Tall
<br>
<br>
<label>Salary:Poor</label>
<input type="range" min="0" max="100">Rich
<br>
</fieldset>
<fieldset>
<legend>Your Contact Information</legend>
<label>Email:</label>
<input type="email" style="width:180;">
<br>
<br>
<label>Mobile:</label>
<input type="tel " width="180px ">
<br>
<br>
<label>Address:</label>
<textarea></textarea>
<br>
<br>
<label>Method to contact you:</label>
<input type="checkbox " ; width="auto ">
<label>Email</label>
<input type="checkbox ">
<label>Whatsapp</label>
<input type="checkbox ">
<label>In-appchat</label>
<input type="checkbox ">
</fieldset>
<input type="submit " value="Submit ">
<script src="https://www.cse.ust.hk/~rossiter/dating_web_site.js "></script>
</form>

Two column checkers with CSS nth-child

I have a form that is divided into two columns with floats. I want to make them "checkered". How can I use nth-child to achieve this? See the screenshot below to see what I mean. Here is my HTML:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
Grade Calculator
</title>
<style type="text/css">
.form-group {
padding: 15px;
width: 45%;
float: left;
}
.form-group:nth-child(3n+0){
background: #e4e4e4;
}
form {
margin: 25px auto;
border-width: 0px 1px;
border-style: solid;
border-color: #ccc;
width: 50%;
}
label {
width: 350px;
margin: 0;
padding: 0;
display: block;
}
input {
width: calc(100% - 20px);
margin: 15px 0px;
}
</style>
</head>
<body>
<form method="post" action="./Default.aspx" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="Era4Q8Ttswx16Rg3XXwdNh7LuVHYalpdgKUCOJGwMcgBX7OP6eVRcScpUQ68BMteFlRltJ8L3vXUMx8wG+4DEf3Oi4RZcMfq/H6H7MbdpUbBLssudRCbS2QNV6vILQ9uBG64j4wb2CKGAAM2+aw+BYfCpxNSeloQ2BbcnUnOHjk=" />
</div>
<div>
<div class="form-group">
<span id="aOneActualLbl">Assignment 1</span>
<input name="aOneActualTxt" type="text" value="8" id="aOneActualTxt" />
<span id="aOnePossibleLbl">Possible</span>
<input name="aOnePossibleTxt" type="text" value="10" id="aOnePossibleTxt" />
</div>
<div class="form-group">
<span id="aTwoActualLbl">Assignment 2</span>
<input name="aTwoActualTxt" type="text" value="8" id="aTwoActualTxt" />
<span id="aTwoPossibleLbl">Possible</span>
<input name="aTwoPossibleTxt" type="text" value="10" id="aTwoPossibleTxt" />
</div>
<div class="form-group">
<span id="aThreeActualLbl">Assignment 3</span>
<input name="aThreeActualTxt" type="text" value="9" id="aThreeActualTxt" />
<span id="aThreePossibleLbl">Possible</span>
<input name="aThreePossibleTxt" type="text" value="10" id="aThreePossibleTxt" />
</div>
<div class="form-group">
<span id="aFourActualLbl">Assignment 4</span>
<input name="aFourActualTxt" type="text" value="9" id="aFourActualTxt" />
<span id="aFourPossibleLbl">Possible</span>
<input name="aFourPossibleTxt" type="text" value="10" id="aFourPossibleTxt" />
</div>
<div class="form-group">
<span id="aFiveActualLbl">Assignment 5</span>
<input name="aFiveActualTxt" type="text" value="8" id="aFiveActualTxt" />
<span id="aFivePossibleLbl">Possible</span>
<input name="aFivePossibleTxt" type="text" value="10" id="aFivePossibleTxt" />
</div>
<div class="form-group">
<span id="aSixActualLbl">Assignment 6</span>
<input name="aSixActualTxt" type="text" value="8" id="aSixActualTxt" />
<span id="aSixPossibleLbl">Possible</span>
<input name="aSixPossibleTxt" type="text" value="10" id="aSixPossibleTxt" />
</div>
<div class="form-group">
<span id="aSevenActualLbl">Assignment 7</span>
<input name="aSevenActualTxt" type="text" value="8" id="aSevenActualTxt" />
<span id="aSevenPossibleLbl">Possible</span>
<input name="aSevenPossibleTxt" type="text" value="10" id="aSevenPossibleTxt" />
</div>
<div class="form-group">
<span id="aEightActualLbl">Assignment 8</span>
<input name="aEightActualTxt" type="text" value="8" id="aEightActualTxt" />
<span id="aEightPossibleLbl">Possible</span>
<input name="aEightPossibleTxt" type="text" value="10" id="aEightPossibleTxt" />
</div>
<div class="form-group">
<span id="aNineActualLbl">Assignment 9</span>
<input name="aNineActualTxt" type="text" value="8" id="aNineActualTxt" />
<span id="aNinePossibleLbl">Possible</span>
<input name="aNinePossibleTxt" type="text" value="10" id="aNinePossibleTxt" />
</div>
<div class="form-group">
<span id="aTenActualLbl">Assignment 10</span>
<input name="aTenActualTxt" type="text" value="8" id="aTenActualTxt" />
<span id="aTenPossibleLbl">Possible</span>
<input name="aTenPossibleTxt" type="text" value="10" id="aTenPossibleTxt" />
</div>
<div class="form-group">
<input type="submit" name="runCalculation" value="Calculate Grade" id="runCalculation" />
<span id="currentGradeLbl">Your current grade is B</span>
</div>
</div>
In the screenshot below, I would like assignment 2, 3, 6, 7, and 10 to be grey to create the checker effect. Is this possible?
I was trying to work this out using a single formula but sometimes it's easy if you break them into multiple series.
2, 6, 10, 14, ... => 4n-2
3, 7, 11, 15, ... => 4n-1
So,
.form-group:nth-child(4n-2), .form-group:nth-child(4n-1){
background: #e4e4e4;
}
check this fiddle

Positioning chechboxes in lines, say of 4 CSS

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; }

Relative positioning in CSS is completely different in Safari and Firefox?

I am new to CSS and have been trying to create a web form with the radio buttons aligned next to text fields. However, in Firefox the radio boxes look fine, but when I check in Safari the radio boxes are in the middle of the text fields.
The CSS looks like this:
input#answers
{
display: block;
height: 31px;
left: 87px;
position: relative;
top: 0px;
width: 350px;
}
input[type="radio"]
{
display: inline- block;
height: 20px;
left: 249px;
position: relative;
top: -30px;
vertical-align: middle;
}
and the HTML like this:
<form id="quizCreator" name="quizCreator" method="post" action="quiz.maker.php">
<label><span><img src="images/quizcreatorText.ques.png" hspace="79px" vspace="70px" class="titles" /></span> <br />
<input type="text" name="question" id="question" />
</label>
<label><img src="images/quizcreatorText.ans.png" hspace="79px" vspace="70px" class="titles" id="ans" /> <br />
<input type="hidden" name="creator" value="myform" />
<br />
<input type="text" name="answer1" id="answers" />
</label>
<label>
<input type="radio" name="radio" id="radio1" value="radio1" />
</label>
<label>
<input type="text" name="answer2" id="answers" />
</label>
<label>
<input type="radio" name="radio" id="radio3" value="radio2" />
</label>
<label>
<input type="text" name="answer3" id="answers" />
</label>
<label>
<input name="radio" type="radio" class="radio" id="radio3" value="radio3" />
</label>
<label>
<input type="text" name="answer4" id="answers" />
</label>
<label>
<input name="radio" type="radio" id="radio4" value="radio4" />
</label>
<span><input type="image" src="images/quiznameText.next.png" name="nextPage" id="nextPage" class="nxtbutton" /></span>
</form>
I've tried using relative positioning and margins, but while it fixes the problems in Safari, Firefox then looks wrong. Is there a way to make them both work as I want with a single set of code? (And what about MSIE?)
You should not be using relative positioning for this.
The proper structure is something like this (not sure if you want the text before or after):
<div class="answers">
<ul>
<li><label>your text</label><input type="radio" /></li>
...repeat...
</ul>
</div>
CSS:
.answers ul, .answers li {
list-style-type:none;
margin:0;
padding:0;
}
.answers li {
clear:both
}
.answers label {
display:block;
float:left;
width:100px;
}
.answers input {
display:block;
float:left;
}

Resources