div ignoring explicitly set width - html

I've got a container that has a contact form in it.. the form is ignoring my width of 140px and somehow computing itself out to 300px. no idea where it's coming from.
HTML:
<div id="main" role="main">
<div id="mail">
<form id="signup" action="<?=$_SERVER['PHP_SELF']; ?>" method="get">
<fieldset>
<span id="response">
<? require_once('php/store-address.php'); if($_GET['submit']){ echo storeAddress(); } ?>
</span>
<input type="email" name="email" id="email" placeholder="Enter your email address" />
<input type="submit" id="submit" class="btn" value="Go" />
</fieldset>
</form>
</div>
</div>
CSS:
#main {
width:300px;
height:110px;
padding:10px 20px 10px 20px;
position:absolute;
bottom:50px;
left:50%;
margin-left:-170px;
background-color: #f0f3f8;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#f0f3f8), to(#a9a9ad));
background: -moz-linear-gradient(100% 100% 90deg, #a9a9ad, #f0f3f8);
background: -o-linear-gradient(#f0f3f8, #a9a9ad);
border-radius: 10px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
//text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
//border-bottom: 1px solid rgba(0,0,0,0.25);
box-shadow: 0 1px 3px rgba(0,0,0,0.5);
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
////////CONTACT FORM
#mail {
width:140px;
height:95px;
float:right;
display:block;
/*background: #c9d0de; border: 1px solid #e1e1e1;
-moz-box-shadow: 0px 0px 8px #444;
-webkit-box-shadow: 0px 0px 8px #444;*/
}
#response {
width:140px;
height:25px;
margin-bottom:10px;
display:block;
font-style:italic;
}
input {
width: 124px;
height: 9px;
padding: 8px;
margin: 0 0 10px 0;
background: #5E768D;
background: -moz-linear-gradient(top, #546A7F 0%, #5E768D 20%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#546A7F), color-stop(20%,#5E768D));
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
-moz-box-shadow: 0px 1px 0px #f2f2f2;
-webkit-box-shadow: 0px 1px 0px #f2f2f2;
font-family: sans-serif;
font-size: 10px;
color: #f2f2f2;
text-shadow: 0px -1px 0px #334f71;
outline:none;
}
input::-webkit-input-placeholder {
color: #a1b2c3; text-shadow: 0px -1px 0px #38506b;
}
input:-moz-placeholder {
color: #a1b2c3; text-shadow: 0px -1px 0px #38506b;
}
input:focus, textarea:focus {
background: #728eaa;
background: -moz-linear-gradient(top, #668099 0%, #728eaa 20%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#668099), color-stop(20%,#728eaa));
}
input[type=submit] {
width: 40px;
height: 25px;
padding:5px;
margin: 0 auto;
display:block;
-moz-box-shadow: 0px 0px 5px #999;-webkit-box-shadow: 0px 0px 5px #999;
border: 1px solid #556f8c;
background: -moz-linear-gradient(top, #718DA9 0%, #415D79 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#718DA9), color-stop(100%,#415D79));
cursor: pointer;
}
JSFiddle link

You can't have comments with //. Only multi-line comments work with css. You'll have to remove this comment:
////////CONTACT FORM
The rest of your styles should work after you remove that.

Related

Chrome hide menu items with background img

I have a menu with a background img in hover.
Only with crhome, i dont see the menu voices when I load the page.
Following, if I go with the mouse to select the voice, appears the menu voices with the img's background, and remains.
I dont have this problem with firefox.
That's the CSS code:
#header {
width: 100%;
text-align: left;
display: block;
height: 60px;
margin: auto ;
width: 100%;
font-size: 130%;
z-index: 10px;
background-color: white;
border-bottom: 1px solid lightgray;
}
#header .main_menu {
height: 100%;
margin: 0 auto;
text-align: center;
width: 700px;
padding-top: 7.5px;
z-index:100;
}
#header .main_menu .normal {
display: inline-block;
width: 100px;
font-weight: bolder;
border-radius: 20px;
padding: 10px 0px;
height: 14px;
border: 2px solid white;
}
.main_menu .logo_main_menu{
display: inline-block;
width: 140px;
font-weight: bolder;
border-radius: 10px;
padding: 14px 0px;
height: 11.5px;
border: 2px solid white;
}
.main_menu .logo_main_menu:hover ,#header .here_home {
color: transparent;
background: url("../images/logo_tapling.png") ;
background-size: 140px;
}
.normal:hover , #header .active{
background: url("../images/bg_tapling.png") ;
color: white;
-moz-box-shadow: 0px 0px 2px 0px black ;
-ms-box-shadow: 0px 0px 2px 0px black ;
-webkit-box-shadow: 0px 0px 2px 0px black ;
box-shadow: 0px 0px 2px 0px black ;
}
.free_img_2{
display: none;position: relative;height: 100px;margin-bottom: -100px;
float: right;right: 146px;z-index: 20;
}
.free_img{
position: relative; height: 100px;margin-bottom: -100px;
float: right;top:-5px;right: -8px;
}
#header .main_menu .normal a:hover {
}
.can_bg{
border: 2px white solid;
}
#header .normal .active ,#header .normal .main_menu a:hover
{
}
#mainmenu2{
z-index: 10;
position: relative;
/*top:60px;*/
/*left:50%;*/
/*margin-left: -235px;*/
/*right: auto;*/
/*margin:62px auto ;*/
}
#mainmenu2{
display: none;
border-left:2px solid white;
border-right: 2px solid white;
border-bottom: 2px solid white;
-moz-box-shadow: 2px 8px 6px -3px black ;
-ms-box-shadow: 2px 8px 6px -3px black ;
-webkit-box-shadow:2px 8px 6px -3px black;
box-shadow: 2px 8px 6px -3px black;
border-radius:0px 0px 10px 10px;
border-radius: 0 0 10px 10px;
color:black;
padding: 5px 0;
text-align:center;
font-weight:900;
background: url("../images/bg_tapling.png") ;
}
#mainmenu2 ul{
margin: 0px;
padding: 0px;
}
#mainmenu2 li a{
color: white;
text-shadow: none;
}
#mainmenu2 li a:hover{
color: green;
}
#mainmenu2 li .active{
color: lightgreen;
}
#mainmenu2 li{
width: 40%;
text-align: center;
margin: 2.5px auto ;
padding: 10px;
-moz-box-shadow:inset 0px 1px 0px 0px black;
-ms-box-shadow:inset 0px 1px 0px 0px black;
-webkit-box-shadow:inset 0px 1px 0px 0px black;
box-shadow:inset 0px 1px 0px 0px #ffffff;
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05,
#ededed),color-stop(1, #000000) );
background:-moz-linear-gradient( center top, #ededed 5%, #000000 100% );
background:-ms-linear-gradient( center top, #ededed 5%, #000000 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed',
endColorstr='#000000');
background-color:black;
-moz-border-radius:6px;
-webkit-border-radius:6px;
-ms-border-radius:6px;
border-radius:6px;
/*border:1px solid #dcdcdc;*/
display:inline-block;
color:#777777;
font-family:arial;
font-size:15px;
font-weight:bold;
/*padding-right: 2.5%;*/
text-decoration:none;
text-shadow:1px 1px 0px #ffffff;
}
#mainmenu2 li:hover {
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05,
#dfdfdf), color-stop(1, #ededed) );
background:-moz-linear-gradient( center top, #dfdfdf 5%, #ededed 100% );
background:-ms-linear-gradient( center top, #dfdfdf 5%, #ededed 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#dfdfdf',
endColorstr='#ededed');
background-color:#dfdfdf;
}
.logo {
float: left;
margin: 0;
padding: 5px auto;
height: 100%;
}
.logo img {
height: 56px;
}
#header .menu {
width: 434px;
margin: 0 auto;
}
.menu{
display: none;
}
And this is HTML:
<div id="header">
<div class="menu">
<div class="logo">
<a href="<?=URL?>" >
<img src="<?php echo URL; ?>theme/<?= $this->_theme ? >/images/logo_tapling.png" />
</a>
<div class="separatore"></div>
</div>
<div class="btn-responsive-menu">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</div>
</div>
<div class="main_menu">
<a href="<?=URL?>classifica" class="normal <?=$classifica?> ">Classifica
</a>
<a href="<?=URL?>regole" class="normal <?=$regole?>">
Regole
</a>
<a href="<?=URL?>" class="logo_main_menu <?=$home?> " >
Tapling
</a>
Faq
Contatti
</div>
</div>
Tnx so much!
change this
.normal:hover , #header .active{
background: url("../images/bg_tapling.png") ;
color: white;
-moz-box-shadow: 0px 0px 2px 0px black ;
-ms-box-shadow: 0px 0px 2px 0px black ;
-webkit-box-shadow: 0px 0px 2px 0px black ;
box-shadow: 0px 0px 2px 0px black ;
}
to this
.normal:hover , #header .active{
background: url("../images/bg_tapling.png") ;
-moz-box-shadow: 0px 0px 2px 0px black ;
-ms-box-shadow: 0px 0px 2px 0px black ;
-webkit-box-shadow: 0px 0px 2px 0px black ;
box-shadow: 0px 0px 2px 0px black ;
}

Prevent overlapping elements in CSS [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
This question has been asked before, however each situation is unique. I have a screenshot of a website that has a login box (registration box) with a sticky note on the side to tell the users what information to enter.
Screenshot below:
The registration box is over lapping the sticky note when the user resizes his browser window. Also the login box is overlapping the logo on the top. A solution that is cross compatible with many browsers would be nice (if possible).
Here is my CSS:
.box
{
background:#fefefe;
border: 1px solid #C3D4DB;
border-top:1px;
-webkit-border-radius:5px;
-moz-border-radius:5px;
border-radius:5px;
-moz-box-shadow:rgba(0,0,0,0.15) 0 0 1px;
-webkit-box-shadow:rgba(0,0,0,0.15) 0 0 1px;
box-shadow:rgba(0,0,0,0.15) 0 0 1px;
color:#444;
font:normal 12px/14px Arial, Helvetica, Sans-serif;
margin:0 auto 30px;
overflow:hidden;
}
.box.login
{
height:480px;
width:332px;
position:absolute;
left:50%;
top:37%;
margin:-130px 0 0 -166px;
}
.boxBody
{
background:#fefefe;
border-top:1px solid #dde0e8;
padding:10px 20px;
}
.box footer
{
background:#eff4f6;
border-top:1px solid #dde0e8;
padding:22px 26px;
overflow:hidden;
height:32px;
}
.box label
{
display:block;
font:14px/22px Arial, Helvetica, Sans-serif;
margin:10px 0 0 6px;
}
.box footer label{
float:left;
margin:4px 0 0;
}
.box footer input[type=checkbox]{
vertical-align:sub;
*vertical-align:middle;
margin-right:10px;
.sticky {
/* General */
margin: 0 auto;
padding: 8px 24px;
/*width: 370px; */
max-width: 370px;
height: auto;
width: auto\9;
position: fixed;
left: 3%;
top: 35%;
/* Font */
font-family: 'Nothing You Could Do', cursive;
font-size: 1.4em;
/* Border */
border:1px #E8Ds47 solid;
/* Shadow */
-moz-box-shadow:0px 0px 6px 1px #333333;
-webkit-box-shadow:0px 0px 6px 1px #333333;
box-shadow:0px 0px 6px 1px #333333;
/* Background */
background: #fefdca; /* Old browsers */
background: -moz-linear-gradient(top, #fefdca 0%, #f7f381 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fefdca), c$
background: -webkit-linear-gradient(top, #fefdca 0%,#f7f381 100%); /* Chrome10+,Safar$
background: -o-linear-gradient(top, #fefdca 0%,#f7f381 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #fefdca 0%,#f7f381 100%); /* IE10+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fefdca', endColor$
background: linear-gradient(top, #fefdca 0%,#f7f381 100%); /* W3C; A catch-all for ev$
}
.sticky ol {
margin: 12px;
}
.sticky p {
text-align: center;
}
And here is my HTML:
<!DOCTYPE HTML>
<html>
<head>
<title>Secure Customer Login</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0$
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="stylesheet" type="text/css" href="css/reset.css">
<link rel="stylesheet" type="text/css" href="css/structure_register.css">
<link href='https://fonts.googleapis.com/css?family=Nothing+You+Could+Do' rel='styleshe$
<script>document.createElement('footer');</script>
</head>
<center><img src="/images/logo.png"></center>
<body>
<div class="sticky">
<p>
<strong>Please Note</strong>
<br />
</p>
<ol>
<li>Please use your real name (your information is secure and will NOT be shared)$
<li>Capitalize the first letter of your first name and last name (i.e. John Doe)<$
<li>Use your email address for the username, otherwise you will not be able to ac$
<li>Use a secure password that cannot be easily guessed</li>
</ol>
</div>
<form class="box login" name="register" action="<?php echo $_SERVER['PHP_SELF']; ?>" meth$
<fieldset class="boxBody">
<label>First Name</label>
<input type="text" name="firstname" maxlength="50" tabindex="1" placeholder="First Na$
<label>Last Name</label>
<input type="text" name="lastname" maxlength="50" tabindex="2" placeholder="Last Name$
<label>Username</label>
<input type="email" name="username" maxlength="50" tabindex="3" placeholder="Email" r$
<label>Password</label>
<input type="password" placeholder="Password" name="pass1" tabindex="4" />
<label>Repeat Password</label>
<input type="password" placeholder="Repeat Password" name="pass2" tabindex="5" />
</fieldset>
<footer>
<center><input type="submit" name="submit" value="Register" class="btnLogin" /></cent$
</footer>
</form>
<footer id="main">
© 2014 Rye High Group. All rights reserved.</a>
</footer>
</body>
</html>
Your help is very much appreciated, I love this community!
Thanks,
Fixnode
Try this http://jsfiddle.net/ab5KN/
HTML:
<body>
<div class="img">
<img src="http://rye-high.ca/images/logo.png" />
</div>
<div class="sticky">
<p> <strong>Please Note</strong>
<br />
</p>
<ol>
<li>Please use your real name (your information is secure and will NOT be shared) </li>
<li>Capitalize the first letter of your first name and last name (i.e. John Doe)</li>
<li>Use your email address for the username, otherwise you will not be able to access your account</li>
<li>Use a secure password that cannot be easily guessed</li>
</ol>
</div>
<div class="box">
<form class="login" name="register" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<fieldset class="boxBody">
<label>First Name</label>
<input type="text" name="firstname" maxlength="50" tabindex="1" placeholder="First Name" required />
<label>Last Name</label>
<input type="text" name="lastname" maxlength="50" tabindex="2" placeholder="Last Name" required />
<label>Username</label>
<input type="email" name="username" maxlength="50" tabindex="3" placeholder="Email" required />
<label>Password</label>
<input type="password" placeholder="Password" name="pass1" tabindex="4" />
<label>Repeat Password</label>
<input type="password" placeholder="Repeat Password" name="pass2" tabindex="5" />
</fieldset>
<footer>
<center>
<input type="submit" name="submit" value="Register" class="btnLogin" />
</center>
</footer>
</form>
</div>
<footer id="main">© 2014 Rye High Group. All rights reserved.</a>
</footer>
</body>
CSS:
body {
background:#eff3f6;
width: 1000px;
}
.img {
/*display: block;*/
width:300px;
margin: 0 auto;
}
.box {
width:332px;
margin: 5px auto;
background:#fefefe;
border: 1px solid #C3D4DB;
border-top:1px;
-webkit-border-radius:5px;
-moz-border-radius:5px;
border-radius:5px;
-moz-box-shadow:rgba(0, 0, 0, 0.15) 0 0 1px;
-webkit-box-shadow:rgba(0, 0, 0, 0.15) 0 0 1px;
box-shadow:rgba(0, 0, 0, 0.15) 0 0 1px;
color:#444;
font:normal 12px/14px Arial, Helvetica, Sans-serif;
/*margin:0 auto 30px;*/
overflow:hidden;
position: block;
z-index: -1;
padding-top: 3px;
}
.box.login {
height:480px;
width:150px;
margin: 0 auto;
}
.login fieldset{
border: 0px;
}
.boxBody {
background:#fefefe;
border-top:1px solid #dde0e8;
padding:10px 20px;
}
.box footer {
background:#eff4f6;
border-top:1px solid #dde0e8;
padding:22px 26px;
overflow:hidden;
height:32px;
}
.box label {
display:block;
font:14px/22px Arial, Helvetica, Sans-serif;
margin:10px 0 0 6px;
}
.box footer label {
float:left;
margin:4px 0 0;
}
.box footer input[type=checkbox] {
vertical-align:sub;
*vertical-align:middle;
margin-right:10px;
}
/*Alert Box*/
.alert {
background: #fff6bf url(../images/exclamation.png) center no-repeat;
background-position: 15px 50%;
text-align: center;
padding: 5px 20px 5px 45px;
border-top: 2px solid #ffd324;
border-bottom: 2px solid #ffd324;
}
.info {
background: #CDFECD url(../images/information.png) center no-repeat;
background-position: 15px 50%;
text-align: center;
padding: 5px 20px 5px 45px;
border-top: 2px solid #90EE90;
border-bottom: 2px solid #90EE90;
}
.error {
background: #FFBFBF url(../images/error.png) center no-repeat;
background-position: 15px 50%;
text-align: center;
padding: 5px 20px 5px 45px;
border-top: 2px solid #FF2424;
border-bottom: 2px solid #FF2424;
}
.box input[type=email], .box input[type=password], .box input[type=text], .txtField, .cjComboBox {
border:6px solid #F7F9FA;
-webkit-border-radius:3px;
-moz-border-radius:3px;
border-radius:3px;
-moz-box-shadow:2px 3px 3px rgba(0, 0, 0, 0.06) inset, 0 0 1px #95a2a7 inset;
-webkit-box-shadow:2px 3px 3px rgba(0, 0, 0, 0.06) inset, 0 0 1px #95a2a7 inset;
box-shadow:2px 3px 3px rgba(0, 0, 0, 0.06) inset, 0 0 1px #95a2a7 inset;
margin:3px 0 4px;
padding:8px 6px;
width:270px;
display:block;
}
.box input[type=email]:focus, .box input[type=password]:focus, .box input[type=text]:focus, .txtField:focus, .cjComboBox:focus {
border:6px solid #f0f7fc;
-moz-box-shadow:2px 3px 3px rgba(0, 0, 0, 0.04) inset, 0 0 1px #0d6db6 inset;
-webkit-box-shadow:2px 3px 3px rgba(0, 0, 0, 0.04) inset, 0 0 1px #0d6db6 inset;
box-shadow:2px 3px 3px rgba(0, 0, 0, 0.04) inset, 0 0 1px #0d6db6 inset;
color:#333;
}
.cjComboBox {
width:294px;
}
.cjComboBox.small {
padding:3px 2px 3px 6px;
width:100px;
border-width:3px !important;
}
.txtField.small {
padding:3px 6px;
width:200px;
border-width:3px !important;
}
.rLink {
padding:0 6px 0 0;
font-size:11px;
float:right;
}
.box a {
color:#999;
}
.box a:hover, .box a:focus {
text-decoration:underline;
}
.box a:active {
color:#f84747;
}
.btnLogin {
-moz-border-radius:2px;
-webkit-border-radius:2px;
border-radius:15px;
background:#a1d8f0;
background:-moz-linear-gradient(top, #badff3, #7acbed);
background:-webkit-gradient(linear, left top, left bottom, from(#badff3), to(#7acbed));
-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#badff3', EndColorStr='#7acbed')";
border:1px solid #7db0cc !important;
cursor: pointer;
padding:11px 16px;
font:bold 11px/14px Verdana, Tahomma, Geneva;
text-shadow:rgba(0, 0, 0, 0.2) 0 1px 0px;
color:#fff;
-moz-box-shadow:inset rgba(255, 255, 255, 0.6) 0 1px 1px, rgba(0, 0, 0, 0.1) 0 1px 1px;
-webkit-box-shadow:inset rgba(255, 255, 255, 0.6) 0 1px 1px, rgba(0, 0, 0, 0.1) 0 1px 1px;
box-shadow:inset rgba(255, 255, 255, 0.6) 0 1px 1px, rgba(0, 0, 0, 0.1) 0 1px 1px;
margin-left:12px;
padding:7px 21px;
}
.btnLogin:hover, .btnLogin:focus, .btnLogin:active {
background:#a1d8f0;
background:-moz-linear-gradient(top, #7acbed, #badff3);
background:-webkit-gradient(linear, left top, left bottom, from(#7acbed), to(#badff3));
-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#7acbed', EndColorStr='#badff3')";
}
.btnLogin:active {
text-shadow:rgba(0, 0, 0, 0.3) 0 -1px 0px;
}
footer#main {
/*position:fixed;*/
left:0;
bottom:10px;
text-align:center;
font:normal 11px/16px Arial, Helvetica, sans-serif;
width:100%;
}
.sticky {
/* General */
margin: 0 auto;
padding: 8px 4px;
/*width: 370px; */
max-width: 300px;
height: auto;
width: auto\9;
position: absolute;
left: 3%;
top: 250px;
/* Font */
font-family:'Nothing You Could Do', cursive;
font-size: 1em;
/* Border */
border:1px #E8Ds47 solid;
/* Shadow */
-moz-box-shadow:0px 0px 6px 1px #333333;
-webkit-box-shadow:0px 0px 6px 1px #333333;
box-shadow:0px 0px 6px 1px #333333;
/* Background */
background: #fefdca;
/* Old browsers */
background: -moz-linear-gradient(top, #fefdca 0%, #f7f381 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fefdca), color-stop(100%, #f7f381));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #fefdca 0%, #f7f381 100%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #fefdca 0%, #f7f381 100%);
/* Opera11.10+ */
background: -ms-linear-gradient(top, #fefdca 0%, #f7f381 100%);
/* IE10+ */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fefdca', endColorstr='#f7f381', GradientType=0);
/* IE6-9 */
background: linear-gradient(top, #fefdca 0%, #f7f381 100%);
/* W3C; A catch-all for everything else */
}
/*.sticky ol {
margin: 12px;
}*/
.sticky p {
text-align: center;
}
Basically I added a width to the body, or else adjusting the size of the window will always cause something to overlap. I also added in div wrappers around the image and form (not sure if really needed but added for what I consider better structure). Took out some of the positioning css as well as it causes undue pain when trying to do things.
Add this CSS rule:
.box
{
position: relative;
z-index: -1;
}
How about this?
I removed your position absolute styles and added a wrapper around the sticky and the login controls and applied float:left and float: right on them.
The wrapper itself is center aligned to the page.
I edited the fiddle you posted in the comment on a previous answer and updated it here:
http://jsfiddle.net/va45t/1/
#wrapper {
width: 720px;
position: relative;
margin: 0 auto;
}
The other styles changed were .box.login and .sticky

How to make css search form responsive

i am trying to make use of min-width , max-width property but was unable to achieve the results as desired.
here is the code
HTML
<form class="form-wrapper-01">
<input id="search" type="text" />
<input id="submit" type="submit" value="Search" />
</form>
CSS
.form-wrapper-01 {
max-width: 450px;
width:100%;
padding: 10px;
margin: 100px auto;
overflow: hidden;
border-width: 1px;
border-style: solid;
border-color: #dedede #bababa #aaa #bababa;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
background-color: #f6f6f6;
background-image: -webkit-gradient(linear, left top, left bottom, from(#f6f6f6), to(#eae8e8));
background-image: -webkit-linear-gradient(top, #f6f6f6, #eae8e8);
background-image: -moz-linear-gradient(top, #f6f6f6, #eae8e8);
background-image: -ms-linear-gradient(top, #f6f6f6, #eae8e8);
background-image: -o-linear-gradient(top, #f6f6f6, #eae8e8);
background-image: linear-gradient(top, #f6f6f6, #eae8e8);
}
.form-wrapper-01 #search {
max-width: 330px;
width:100%;
height: 20px;
padding: 10px 5px;
float: left;
font: bold 16px 'lucida sans', 'trebuchet MS', 'Tahoma';
border: 1px solid #ccc;
-moz-box-shadow: 0 1px 1px #ddd inset, 0 1px 0 #fff;
-webkit-box-shadow: 0 1px 1px #ddd inset, 0 1px 0 #fff;
box-shadow: 0 1px 1px #ddd inset, 0 1px 0 #fff;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
.form-wrapper-01 #search:focus {
outline: 0;
border-color: #aaa;
-moz-box-shadow: 0 1px 1px #bbb inset;
-webkit-box-shadow: 0 1px 1px #bbb inset;
box-shadow: 0 1px 1px #bbb inset;
}
.form-wrapper-01 #search::-webkit-input-placeholder {
color: #999;
font-weight: normal;
font-size:12px;
font-style:italic;
}
.form-wrapper-01 #search:-moz-placeholder {
color: #999;
font-weight: normal;
font-size:12px;
font-style:italic;
}
.form-wrapper-01 #search:-ms-input-placeholder {
color: #999;
font-weight: normal;
font-size:12px;
font-style:italic;
}
.form-wrapper-01 #submit {
float: right;
border: 1px solid #00748f;
height: 42px;
max-width: 100px;
width:100%;
padding: 0;
cursor: pointer;
font: bold 15px Arial, Helvetica;
color: #fafafa;
text-transform: none;
background-color: #0483a0;
background-image: -webkit-gradient(linear, left top, left bottom, from(#31b2c3), to(#0483a0));
background-image: -webkit-linear-gradient(top, #31b2c3, #0483a0);
background-image: -moz-linear-gradient(top, #31b2c3, #0483a0);
background-image: -ms-linear-gradient(top, #31b2c3, #0483a0);
background-image: -o-linear-gradient(top, #31b2c3, #0483a0);
background-image: linear-gradient(top, #31b2c3, #0483a0);
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
text-shadow: 0 1px 0 rgba(0, 0 ,0, .3);
-moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 1px 0 #fff;
-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 1px 0 #fff;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 1px 0 #fff;
}
.form-wrapper-01 #submit:hover,
.form-wrapper-01 #submit:focus {
background-color: #31b2c3;
background-image: -webkit-gradient(linear, left top, left bottom, from(#0483a0), to(#31b2c3));
background-image: -webkit-linear-gradient(top, #0483a0, #31b2c3);
background-image: -moz-linear-gradient(top, #0483a0, #31b2c3);
background-image: -ms-linear-gradient(top, #0483a0, #31b2c3);
background-image: -o-linear-gradient(top, #0483a0, #31b2c3);
background-image: linear-gradient(top, #0483a0, #31b2c3);
}
.form-wrapper-01 #submit:active {
outline: 0;
-moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
}
.form-wrapper-01 #submit::-moz-focus-inner {
border: 0;
}
here is live example
http://jsfiddle.net/6TUem/
as you can see the problem is with search button which shift itself in next line when you resize the window.i want it to stick with the input [text] field
Why not make something like this?
#media screen and (max-width: 520px) {
.form-wrapper-01 #submit {
float: none;
max-width: none;
margin-top: 1em;
}
.form-wrapper-01 #search {
max-width: none;
width: 100%%;
}
}
(Admittedly, I did change some things such as box-sizing.)
You have to wrap the input in a div and then use some style like this:
.form-wrapper-01 {
background-color: #f3f3f3;
width: 100%;
max-width: 450px;
position: relative;
display: block;
text-align: right;
padding: 10px;
}
#search {
background-color: #ff0000;
position: absolute;
left: 10px;
right: 100px;
}
#search input {
width: 100%;
}
#submit {
width: 80px;
}
See this fiddle: http://jsfiddle.net/6TUem/4/

I can't put my Login Form in the correct place

I am trying ti add this form to my webpage but for some reason I cannot put the form in the top right corner of the header.
Here is the html:
$(function(){
var $form_inputs = $('form input');
var $rainbow_and_border = $('.rain, .border');
/* Used to provide loping animations in fallback mode */
$form_inputs.bind('focus', function(){
$rainbow_and_border.addClass('end').removeClass('unfocus start');
});
$form_inputs.bind('blur', function(){
$rainbow_and_border.addClass('unfocus start').removeClass('end');
});
$form_inputs.first().delay(800).queue(function() {
$(this).focus();
});
});
</script>
<style>
</style>
</head>
<body id="home">
<div class="rain">
<div class="border start">
<form>
<label for="email">Email</label>
<input name="email" type="text" placeholder="Email"/>
<label for="pass">Password</label>
<input name="pass" type="password" placeholder="Password"/>
<input type="submit" value="LOG IN"/>
</form>
</div>
</div>
And this is the all the form CSS if it helps..
/* Login Form
-------------------------------------------*/
.border,
.rain{
height: 170px;
width: 320px;
float: right;
}
/* Layout with mask */
.rain{
padding: 10px 12px 12px 10px;
-moz-box-shadow: 10px 10px 10px rgba(0,0,0,1) inset, -9px -9px 8px rgba(0,0,0,1) inset;
-webkit-box-shadow: 8px 8px 8px rgba(0,0,0,1) inset, -9px -9px 8px rgba(0,0,0,1) inset;
box-shadow: 8px 8px 8px rgba(0,0,0,1) inset, -9px -9px 8px rgba(0,0,0,1) inset;
margin: 0 0 140px 0 auto;
}
/* Artifical "border" to clear border to bypass mask */
.border{
padding: 1px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
.border,
.rain,
.border.start,
.rain.start{
background-repeat: repeat-x, repeat-x, repeat-x, repeat-x;
background-position: 0 0, 0 0, 0 0, 0 0;
/* Blue-ish Green Fallback for Mozilla */
background-image: -moz-linear-gradient(left, #09BA5E 0%, #00C7CE 15%, #3472CF 26%, #00C7CE 48%, #0CCF91 91%, #09BA5E 100%);
/* Add "Highlight" Texture to the Animation */
background-image: -webkit-gradient(linear, left top, right top, color-stop(1%,rgba(0,0,0,.3)), color-stop(23%,rgba(0,0,0,.1)), color-stop(40%,rgba(255,231,87,.1)), color-stop(61%,rgba(255,231,87,.2)), color-stop(70%,rgba(255,231,87,.1)), color-stop(80%,rgba(0,0,0,.1)), color-stop(100%,rgba(0,0,0,.25)));
/* Starting Color */
background-color: #39f;
/* Just do something for IE-suck */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00BA1B', endColorstr='#00BA1B',GradientType=1 );
}
/* Non-keyframe fallback animation */
.border.end,
.rain.end{
-moz-transition-property: background-position;
-moz-transition-duration: 30s;
-moz-transition-timing-function: linear;
-webkit-transition-property: background-position;
-webkit-transition-duration: 30s;
-webkit-transition-timing-function: linear;
-o-transition-property: background-position;
-o-transition-duration: 30s;
-o-transition-timing-function: linear;
transition-property: background-position;
transition-duration: 30s;
transition-timing-function: linear;
background-position: -5400px 0, -4600px 0, -3800px 0, -3000px 0;
}
/* Keyfram-licious animation */
#-webkit-keyframes colors {
0% {background-color: #39f;}
15% {background-color: #F246C9;}
30% {background-color: #4453F2;}
45% {background-color: #44F262;}
60% {background-color: #F257D4;}
75% {background-color: #EDF255;}
90% {background-color: #F20006;}
100% {background-color: #39f;}
}
.border,.rain{
-webkit-animation-direction: normal;
-webkit-animation-duration: 20s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-name: colors;
-webkit-animation-timing-function: ease;
}
/* In-Active State Style */
.border.unfocus{
background: #333 !important;
-moz-box-shadow: 0px 0px 15px rgba(255,255,255,.2);
-webkit-box-shadow: 0px 0px 15px rgba(255,255,255,.2);
box-shadow: 0px 0px 15px rgba(255,255,255,.2);
-webkit-animation-name: none;
}
.rain.unfocus{
background: #000 !important;
-webkit-animation-name: none;
}
/* Regular Form Styles */
form{
background: #212121;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
height: 100%;
width: 100%;
background: -moz-radial-gradient(50% 46% 90deg,circle closest-corner, #242424, #090909);
background: -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 150, from(#242424), to(#090909));
}
form label{
display: block;
padding: 5px 5px 5px 10px;
font-size: 11px;
color: #777;
}
form input{
display: block;
margin: 5px 5px 15px 10px;
width: 85%;
background: #111;
-moz-box-shadow: 0px 0px 4px #000 inset;
-webkit-box-shadow: 0px 0px 4px #000 inset;
box-shadow: 0px 0px 4px #000 inset;
outline: 1px solid #333;
border: 1px solid #000;
padding: 5px;
color: #444;
font-size: 16px;
}
form input:focus{
outline: 1px solid #555;
color: #FFF;
}
input[type="submit"]{
color: #999;
padding: 5px 5px;
float: right;
margin: 20px 0;
border: 1px solid #000;
font-weight: lighter;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
border-radius: 15px;
background: #45484d;
background: -moz-linear-gradient(top, #222 0%, #111 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#222), color-stop(100%,#111));
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#22222', endColorstr='#11111',GradientType=0 );
-moz-box-shadow: 0px 1px 1px #000, 0px 1px 0px rgba(255,255,255,.3) inset;
-webkit-box-shadow: 0px 1px 1px #000, 0px 1px 0px rgba(255,255,255,.3) inset;
box-shadow: 0px 1px 1px #000,0px 1px 0px rgba(255,255,255,.3) inset;
text-shadow: 0 1px 1px #000;
}
You can use absolute positioning for this:
.rain {
position:absolute;
right:0;
top:0;
}

can't align properly my button

I dont find how i can horizontal align my submit button.
i would like to align my submit button to the right of my input field.
i try several things but its not working.
here is my html file :
<body>
<form:form class="form" method="post" action="/it-portail/passwordChange.mvc" commandName='email'>
<h3>Formulaire email</h3>
<form:errors class ="errorPass" path="email" />
<div class="field">
<form:label path="email">Email:</form:label>
<form:input class ="input" path="email" />
<p class="hint">Entrez votre email.</p>
</div>
<input class="button" type="submit" value="VALIDER" />
</form:form>
here is my css file :
.form {
width: 600px;
display:inline-block;
padding: 20px;
background: #f0f0f0;
overflow: auto;
/* Border style */
border: 1px solid #cccccc;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border-radius: 7px;
/* Border Shadow */
-moz-box-shadow: 2px 2px 2px #cccccc;
-webkit-box-shadow: 2px 2px 2px #cccccc;
box-shadow: 2px 2px 2px #cccccc;
position:absolute;
left: 30%;
top: 40%;
width: 600px;
height: 200px;
margin-left: -100px; /* Cette valeur doit être la moitié négative de la valeur du width */
margin-top: -100px; /* Cette valeur doit être la moitié négative de la valeur du height */
}
input {
font-family: Arial, Verdana;
font-size: 15px;
padding: 5px;
padding-top:5px
border: 1px solid #b9bdc1;
width: 150px;
color: #797979;
text-align:center;
}
.field {
margin-top:4px;
margin-bot:2px;
}
.button {
float: none;
margin-top:5px;
font-weight: bold;
line-height: 1;
cursor: pointer;
color: #fff;
vertical-align:40%;
text-shadow: 0 -1px 1px #64799e;
/* Background gradient */
background: #a5b8da;
background: -moz-linear-gradient(top, #a5b8da 0%, #7089b3 100%);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#a5b8da),
to(#7089b3));
/* Border style */
border: 1px solid #5c6f91;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
/* Box shadow */
-moz-box-shadow: inset 0 1px 0 0 #aec3e5;
-webkit-box-shadow: inset 0 1px 0 0 #aec3e5;
box-shadow: inset 0 1px 0 0 #aec3e5;
}
thanks,
Change float: none; to float: right;
DEMO
Add this to your .button css as
position:absolute;
right:15px;
top:145px;
for this I have updated some of your css and html.
css
input {
font-family: Arial, Verdana;
font-size: 15px;
padding: 5px;
padding-top:5px
border: 1px solid #b9bdc1;
width: 150px;
color: #797979;
text-align:center;
float:left;
margin-right:10px;
}
.field {
margin-top:4px;
margin-bot:2px;
}
.button {
float:left;
font-weight: bold;
cursor: pointer;
color: #fff;
text-shadow: 0 -1px 1px #64799e;
/* Background gradient */
background: #a5b8da;
background: -moz-linear-gradient(top, #a5b8da 0%, #7089b3 100%);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#a5b8da),
to(#7089b3));
/* Border style */
border: 1px solid #5c6f91;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
/* Box shadow */
-moz-box-shadow: inset 0 1px 0 0 #aec3e5;
-webkit-box-shadow: inset 0 1px 0 0 #aec3e5;
box-shadow: inset 0 1px 0 0 #aec3e5;
}
.label{
float:left;
margin-right:10px;
}
.hint{
clear:both
}
html
<form:form class="form" method="post" action="/it-portail/passwordChange.mvc" commandName='email'>
<h3>Formulaire email</h3>
<form:errors class ="errorPass" path="email" />
<div class="field">
<form:label path="email" class="label">Email:</form:label>
<input name="" type="text" class ="input" />
<input class="button" type="submit" value="VALIDER" />
<p class="hint">Entrez votre email.</p>
</div>
</form:form>
jsFiddle File
please check this is working for you or not.
Thank you :)
Change your .button's css...
from
float: none;
margin-top:5px;
to
float: right;
margin-top:-25px;
DEMO : http://jsfiddle.net/a4QNB/166/