when adding submit button css doesn't work? - css

<?
$time = $_POST['time'];
echo 'you have choosen '. $time;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
.radio > input[type=radio]{
position:absolute;
margin-left:-99999px;
}
input[type=radio] + span{
cursor:pointer;
border:2px solid transparent;
}
span.active{
background-color:green;
}
.but1{
background-color:#009;
color:#FFF;
border:none;
border-radius:15px;
width:200px;
height:50px;
font-size:18px;
font-weight:bold;
border-radius:15px;
text-align:center;
padding:8px;
font-family:Verdana, Geneva, sans-serif;
float:left;
margin-left:10px;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<form action="Untitled3.php" method="post">
<label class="radio" for="fb1">
<input id="fb1" type="radio" name="time" value="all day" checked />
<span class="but1 active">Available<br>All day</span>
</label>
<label class="radio" for="fb2">
<input id="fb2" type="radio" name="time" value="between 8-12"/>
<span class="but1">Between<br>8am - 12am</span>
</label>
<label class="radio" for="fb3">
<input id="fb3" type="radio" name="time" value="between 12-4" />
<span class="but1">Between<br>12pm - 4pm</span>
</label>
<input name="submit" type="submit" value="send" />
<script type="text/javascript">
$('.radio').click(function(){
if( $(this).find('input').is(":checked") ){
$('.radio span').removeClass('active');
$(this).find('span').addClass('active');
}
});
</script>
</form>
</body>
</html>
Why is it that when I add the submit button, the CSS doesn't work in IE, but fine in all other browsers. When I remove the button, the CSS works fine in all browsers?
Please help, this problem is driving my nuts, IE should be banned.
Live code with the button is http://goo.gl/LbSWQG

Related

Line break for an error message in Angular/CSS

When I enter 1 character in my input, I would like to display an error message min 3 char at the bottom of the input.
Like this example:
For now, I have this:
The error message is on the right
I can use a tag <br> but I think there is a better solution?
I tried this solution, but without success, I don't understand what's wrong.
.lastName {
color: blue;
bottom: 10px;
}
input.ng-pristine {
background-color:yellow;
}
input.ng-touched.ng-invalid {
background-color:red;
}
input.ng-touched.ng-valid {
background-color:green;
}
<!DOCTYPE html>
<html>
<head>
<script src="~/Scripts/angular.js"></script>
<style>
</style>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.16/angular.min.js"></script>
</head>
<body ng-app>
<form name="studentForm" novalidate class="student-form">
<label for="lastName">Last Name</label><br />
<input type="text" name="lastName" ng-minlength="3" ng-maxlength="10" ng-model="lastName" />
<span ng-show="studentForm.lastName.$touched && studentForm.lastName.$error.minlength">min 3 chars.</span>
<span ng-show="studentForm.lastName.$touched && studentForm.lastName.$error.maxlength">Max 10 chars.</span><br /><br />
<input type="submit" value="Save" />
</form>
</body>
</html>
You can make the input a block level element by giving display: block;
input {
display: block;
}
input.ng-pristine {
background-color:yellow;
}
input.ng-touched.ng-invalid {
background-color:red;
}
input.ng-touched.ng-valid {
background-color:green;
}
<!DOCTYPE html>
<html>
<head>
<script src="~/Scripts/angular.js"></script>
<style>
</style>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.16/angular.min.js"></script>
</head>
<body ng-app>
<form name="studentForm" novalidate class="student-form">
<label for="lastName">Last Name</label><br />
<input type="text" name="lastName" ng-minlength="3" ng-maxlength="10" ng-model="lastName" />
<span ng-show="studentForm.lastName.$touched && studentForm.lastName.$error.minlength">min 3 chars.</span>
<span ng-show="studentForm.lastName.$touched && studentForm.lastName.$error.maxlength">Max 10 chars.</span><br />
<input type="submit" value="Save" />
</form>
</body>
</html>

materializecss style radio button as button

I try to style a video controls.
I want two radio buttons for fast forward / rewind.
<input name="group1" type="radio" id="ff" />
<label for="ff"><i class="material-icons">fast_forward</i></label>
<input name="group1" type="radio" id="fr" />
<label for="fr"><i class="material-icons">fast_rewind</i></label>
How can I style them to appear as buttons with pressed state for the selected radio button?
This is a basic sample you can tweak to suit your needs
#help label {
float:left;
width:120px;
margin:0px;
background-color:#FFF;
border-radius:4px;
border:1px solid #D0D0D0;
overflow:auto;
}
#help label span {
text-align:center;
font-size: 16px;
padding:10px 0px;
display:block;
}
#help label input {
position:absolute;
top:-20px;
}
#help input:checked + span {
background-color:indigo;
color:white;
}
#help .white {
background-color:#FFFFFF;
color:#000;
}
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="css/materialize.min.css">
<link rel="stylesheet" type="text/css" href="css/fonts.css">
</head>
<body>
<div id="help" class="row halign">
<label class="white">
<input type="radio" name="unemployment">
<span>I</span>
</label>
<label class="white">
<input type="radio" name="unemployment">
<span>need</span>
</label>
<label class="white">
<input type="radio" name="unemployment">
<span>a</span>
</label>
<label class="white">
<input type="radio" name="unemployment">
<span>job</span>
</label>
</div>
</body>
</html>

CSS - relative positing element to right and moving next element to its place

I think this is very basic CSS question .
But here is the fiddle and below is the code
http://jsfiddle.net/G6pqC/
<!DOCTYPE html>
<html>
<head>
<style>
#topDiv {
width:280px;
height:500px;
background-color:red;
}
.element{
position:relative;
right :100px;
}
</style>
</head>
<body>
<div id="topDiv">
<input type="button" value="button1" />
<input type="button" value="button2" />
<input type="button" value="button3" />
<input class='element' type="button" value="button4" />
<input type="button" value="button5" />
</div>
</body>
</html>
Can I know how I can move button5 to the first line and as a last element ? I moved button 4 to right and now I have place in the first line , But still button5 is going to the next line . Any one please ?
Thanks for your help
Can you increase the width of #topDiv? Like this:
#topDiv {
width:320px;
height:500px;
background-color:red;
}​
http://jsfiddle.net/G6pqC/1/
Here you go - Check this Demo
#topDiv {
width:280px;
height:500px;
background-color:red;
}
input[type="button"]{ margin: 0 0 0 -4px; }
input[type="button"]:first-child { margin: 0; }
Okay, loaded it in Firefox and now I'm seeing it. Just adjust the font size on the buttons.
.element{
font-size:11px;
float:left;
margin-right:5px;
}
#topDiv {
width:280px;
height:500px;
background-color:red;
position:relative;
}
.moved{position:absolute;right:150px;}
<!DOCTYPE html>
<html>
<body>
<div id="topDiv">
<input class='element' type="button" value="button1" />
<input class='element' type="button" value="button2" />
<input class='element' type="button" value="button3" />
<input class='element moved' type="button" value="button4" />
<input class='element' type="button" value="button5" />
</div>
</body>
</html>
#topDiv {
width:280px;
height:500px;
background-color:red;
}
.element{
float: right;
}
<!DOCTYPE html>
<html>
<body>
<div id="topDiv">
<input class='element' type="button" value="button1" />
<input class='element' type="button" value="button2" />
<input class='element' type="button" value="button3" />
<input class='element' type="button" value="button4" />
<input class='element'type="button" value="button5" />
</div>
</body>
</html>
not sure if this is what ur after but there.
​

dynamically expand tags

I'm having problems with setting the div and body tags to dynamically expand over the inner contain.
Here is the HTML and CSS that I'm using, it is a little longer.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
<title></title>
</head>
<style>
body, p, b, ul, li, div
{
padding:0;
margin:0;
border:0;
font-family:Arial, Helvetica, sans-serif;
}
body
{
background:white;
}
.clearfix {
min-height: 1px;
}
.clearfix:after {
content: ".";
display: block;
height: 0;
font-size: 0;
clear: both;
visibility: hidden;
}
#searchform
{
position:absolute;
height:110px;
clear:both;
}
#b2_sbox_middle
{
width:980px;
height:99px;
background:url('img.jpg') repeat-x;
border:1px solid #00CCCC;
}
#b2_inner_sf
{
margin-top:10px;
}
#sf_ch_container
{
clear:both;
margin-left:27px;
font-size:18px;
}
#sf_ch_formtitle
{
float:left;
width:202px;
font-size:18px;
text-align:left;
}
#sf_ch_stype
{
float:left;
}
.stype
{
float:left;
margin-left:27px;
text-align: left;
}
</style>
<body>
<div align="center" class="clearfix">
<div id="searchform" align="center" style="top:105px; width:980px; margin-left:-490px; left:50%;" class="clearfix">
<div id="b2_sbox_middle">
<div id="b2_inner_sf" class="clearfix" style="border:0px solid;">
<div id="sf_ch_container" class="clearfix">
<div id="sf_ch_formtitle">SEARCH </div>
<div id="sf_ch_stype"> SEARCH</div>
</div>
<div class="stype">
<input name="text" class="search-input" type="text" value="key" size="20" maxlength="50" />
</div>
<div class="stype" >
<input name="text2" class="search-input" type="text" value="key" size="20" maxlength="40" />
</div>
<div class="stype" >
<input name="text2" class="search-input" type="text" value="key" size="20" maxlength="40" />
</div>
<div class="stype" >
<input name="text2" class="search-input" type="text" value="key" size="20" maxlength="40" />
</div>
</div>
</div>
</div>
</div>
</body>
</html>
If you run the code in Firefox or Chrome press F12 and watch the height of the body tag and of the first div after the body, you will see that none have dynamically changed their height to include the inner content.
I don't know where the problems is in the CSS.
And a second problem, if you make a preview using IE v.6 you will see that all the input fileds are disorder wich I don't understand why??
Any help will be much appreciated!!
Since #searchform is absolutely positioned, its parents will have a height of 0. You can try:
body, body>div{min-height:100%;}
Here's a fiddle: http://jsfiddle.net/jEfMx/

form not showing up properly in chrome and IE6

Here is my page. I need to insert whole code here.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="js/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#tabs ul li:first a').addClass("active");
$('#forms').find('form').hide().fadeIn(1500);
$("#tabs ul li").click(function() {
$("#tabs ul li").removeClass("active");
$(this).addClass("active");
$("#forms form").hide();
var activeTab = $(this).find("a").attr("href");
$(activeTab).fadeIn();
return false;
});
});
</script>
<style type="text/css">
* { margin:0; padding:0; }
body { background:#27476B; }
.clear { clear:both; }
#wrapper { width:510px; height:331px; overflow:hidden; padding:10px; }
#tabs ul { padding-left:15px; list-style:none; }
#tabs ul li { display:block; float:left; text-align:center; }
#tabs ul li a { padding:3px 20px 2px 20px; color:#fff; text-decoration:none; border-top:1px solid #ccc; border-left:1px solid #ccc; border-right:1px solid #ccc; }
#tabs ul li a:hover { background:#AEBAC1; }
#tabs ul li a.active, #tabs ul li.active a:hover { background:#AEBAC1; color:#333; }
#forms form { background:#AEBAC1; border:2px solid #333; padding-left:5px; }
.twocol { display:block; float:left; width:250px; margin-bottom:10px; }
.twocol label { margin-top:.33em; display:block; width:240px;}
.twocol select, .twocol input[type="text"] { background:#456A87; color:#fff; display:block; width:240px; font-size:16px; }
.twocol span { padding:0 8px 0 5px; }
.search { width:500px; text-align:center; margin-bottom:5px; }
</style>
</head>
<body>
<div id="wrapper">
<div id="tabs">
<ul>
<li>Properties</li>
<li>Developments</li>
<li>Agents</li>
</ul>
</div>
<div class="clear"></div>
<div id="forms">
<!--
Search Form for Properties
-->
<form id="properties" name="properties" method="post" action="">
<div class="twocol">
<label for="city">City:</label>
<select name="city" size="1">
<option>-</option><option>asdfadf</option><option>-</option>
</select>
<label for="bedrooms">Bedroom:</label>
<select name="bedrooms" size="1">
<option>-</option>
</select>
<label for="minprice">Minimum Price:</label>
<select name="minprice" size="1">
<option>-</option>
</select>
<label for="minarea">Minimum Area:</label>
<select name="minarea" size="1">
<option>-</option>
</select>
<label for="propertytype">Property Type:</label>
<select name="propertytype" size="1">
<option>-</option>
</select>
</div>
<div class="twocol">
<label for="location">Location:</label>
<select name="location" size="1">
<option>-</option>
</select>
<label for="addedwithin">Added Within:</label>
<select name="addedwithin" size="1">
<option>-</option>
</select>
<label for="maxprice">Maximum Price:</label>
<select name="maxprice" size="1">
<option>-</option>
</select>
<label for="maxarea">Maximum Area:</label>
<select name="maxarea" size="1">
<option>-</option>
</select>
<label for="searchfor">Search For:</label>
<input name="searchfor" type="radio" value="sale" /><span>Sale</span>
<input name="searchfor" type="radio" value="purchase" /><span>Purchase</span>
<input name="searchfor" type="radio" value="rental" /><span>Rental</span>
</div>
<hr class="clear" /><br />
<div class="search">
<input type="submit" value="Search" />
</div>
</form>
<!--
Search Form for Developments
-->
<form id="developments" name="developments" method="post" action="">
<div class="twocol">
<label for="city">City:</label>
<select name="city" size="1">
<option>-</option><option>asdfadf</option><option>-</option>
</select>
</div>
<div class="twocol">
<label for="developmentname">Development name:</label>
<input type="text" name="developementname" />
</div>
<hr class="clear" /><br />
<div class="search">
<input type="submit" value="Search" />
</div>
</form>
</div>
</div>
</body>
</html>
Here is the perfect view (on Firefox)
Following problems are identified by me, Please let me know if there are some others too.
IE8 and Chrome are showing some extra height (which is displaying a little part of 2nd form)
IE6 not showing the width specified in CSS.
In IE6, initially tabs div is touching with the forms div. But on mouse over it adds some extra spacing.
How can it be solved.
I am not sure what you mean by points 1 & 2, but 3 I got it fixed. I might have fixed 1 & 2(not sure).
Let me know how this works for you.
http://jsfiddle.net/3uMyA/3/

Resources