I have a contact form on this page: http://thehummingbirdplace.com/contact.html
The form's "comments" section has a large indent in the field when you click it to type. The indent can be deleted when typing, but I can't figure out how to get rid of it from the get go.
Here's the code for the form:
<div id="contactForm">
<form class="group" method="post" action="contact1.php">
<label for="text1">Name: </label>
<input name="name" type="text" id="text1" required>
<label for="text2">E-Mail: </label>
<input name="email" type="email" id="text2" required>
<label for="commentsfield" class="commentbox">Comments: </label>
<textarea name="comments" id="commentsfield"
cols=30 rows=9>
</textarea>
<input type="submit" value="submit"/>
</form>
</div>
Here's all the css I'm using on it:
#contactForm {
margin-left: auto;
margin-right: auto;
width: 520px;
height: 500px;
}
form {
padding-right: 15px;
padding-bottom: 0px;
padding-left: 15px;
position: absolute;
z-index: 1;
}
label {
display: block;
width: 270px;
padding-top: 15px;
margin-top: 0;
margin-bottom: 0;
margin-left: 15px;
}
label.commentbox {
width: 501px;
}
form * {
background: transparent;
behavior: url(../_assets/PIE.htc);
}
input {
-webkit-appearance: none;
-moz-appearance: none;
border: none;
background: none;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
padding: 0;
margin: 0;
}
.group:before, .group:after {
content: "\0020";
display: block;
height: 0;
overflow; hidden;
}
.group:after {
clear: both;
}
.group {
zoom: 1;
}
input[type=text], input[type=email] {
width: 270px;
}
textarea {
width: 500px;
}
input[type=text], input[type=email] {
padding: 5px;
}
input[type=text], input[type=email], textarea {
display: block;
border: 1px solid #EAEAEA;
font-size: 16px;
background-color: #fff;
color: #666;
box-shadow: 0px 2px 3px rgba(255,255,255,0.5);
}
input:focus, textarea:focus {
}
input[type=email] {
padding-right: 10px;
}
input[type=submit] {
padding: 5px;
background: #666;
color: white;
border: none;
margin-top: 15px;
font-size: 100%;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
input[type=text].required {
padding-left: 10px;
}
input.required {
background: webkit-linear-gradient(#FFF, #DDD);
background: moz-linear-gradient(#FFF, #DDD);
background: ms-linear-gradient(#FFF, #DDD);
background: o-linear-gradient(#FFF, #DDD);
background: linear-gradient(#FFF, #DDD);
-pie-background: linear-gradient(#FFF, #DDD);
}
::-webkit-scrollbar {
width: 12px;
}
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
border-radius: 10px;
}
::-webkit-scrollbar-thumb {
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
}
I haven't seen this happen before, and nothing stands out to me as causing the intent in the form. Any help would be greatly appreciated!
You need to get rid of the white space between your textarea tag
<textarea name="comments" id="commentsfield" cols=30 rows=9></textarea>
Buggy Demo
Fixed Demo
You have a big gap between your <textarea> </textarea>
Replace this:-
<textarea name="comments" id="commentsfield" cols="30" rows="9"> </textarea>
With this one :-
<textarea name="comments" id="commentsfield" cols="30" rows="9"></textarea>
Related
As you can see on the snippet, I've got spacing on the corners somehow. I need to remove spacing and make it look like a regular border. That's it
form {
width: 400px;
height: 50px;
display: flex;
flex-direction: row;
border: solid #D3D8E0 1px;
margin-bottom: 0px;
border-radius: 8px;
}
input[type="email"] {
flex-grow: 2;
margin: 0px;
padding: 0px;
width: 100%;
border: none;
}
input[type="submit"] {
height: 44px;
background: #0CB66E;
color: #fff;
font-size: 15px;
font-weight: 600;
border: none;
border-radius: 6px;
margin: 3px 3px 0 0;
}
input[type="email"]:focus {
outline: none;
}
<form id="form" action="https://www.freecodecamp.com/email-submit" method="GET">
<input id="email" type="email" placeholder="Email" required>
<input id="submit" type="submit" value="Get started">
</form>
You forgot to add a border-radius on your input type email.
form {
width: 400px;
height: 50px;
display: flex;
flex-direction: row;
border: solid #D3D8E0 1px;
margin-bottom: 0px;
border-radius: 8px;
}
input[type="email"] {
flex-grow: 2;
margin: 0px;
padding: 0px;
width: 100%;
border: none;
border-radius: 8px;
}
input[type="submit"] {
height: 44px;
background: #0CB66E;
color: #fff;
font-size: 15px;
font-weight: 600;
border: none;
border-radius: 6px;
margin: 3px 3px 0 0;
}
input[type="email"]:focus {
outline: none;
}
<form id="form" action="https://www.freecodecamp.com/email-submit" method="GET">
<input id="email" type="email" placeholder="Email" required>
<input id="submit" type="submit" value="Get started">
</form>
The input[type="email"] has a border-radius of 0 so cuts through it. Change it to this:
input[type="email"] {
flex-grow: 2;
margin: 0px;
padding: 0px;
width: 100%;
border: none;
border-radius: 6px;
}
input[type="email"] {
flex-grow: 2;
margin: 0px;
padding: 0px;
width: 100%;
border: none;
border-radius: 6px 0 0 6px;
}
How do I adjust the text input position in the input box? I did do input[type=text] but it messes up my input box's position completely. I did change my ::placeholder left margin a little bit in case if you want to know.
HTML & CSS
.registerbox {
width: 500px;
height: 450px;
background: rgba(255, 255, 255, 0.7);
margin: 10px auto;
border-radius: 20px;
box-shadow: 0 0 40px 10px rgba(0, 0, 0, 0.6);
color: white;
}
.inner-registerbox {
position: relative;
width: 100%;
height: 100%;
}
.registerbox-front {
position: absolute;
height: 100%;
width: 100%;
padding: 55px;
box-sizing: border-box;
border-radius: 14px;
}
input label {
display: block;
}
.registerbox h2 {
text-align: center;
font-size: 25px;
font-weight: normal;
margin-bottom: 20px;
margin-top: 0;
color: black;
}
.input-box2 {
width: 95%;
background: transparent;
border: 1px solid black;
height: 32px;
border-radius: 5px;
padding: 0 0px;
box-sizing: border-box;
outline: none;
text-align: left;
color: black;
display: table;
margin-top: 2px;
margin-bottom: 15px;
}
.input-box3 {
width: 105%;
background: transparent;
border: 1px solid black;
height: 32px;
border-radius: 5px;
padding: 0 0px;
box-sizing: border-box;
outline: none;
text-align: left;
color: black;
display: table;
margin-top: 2px;
margin-bottom: 15px;
}
.registerbox-front ::placeholder {
padding-left: 10px;
}
.box-firstline, .box-secondline {
margin-top: 10px
}
<body>
<div class="registerbox">
<div class="inner-registerbox">
<div class="registerbox-front">
<h2>BORANG PENDAFTARAN MURID</h2>
<form>
<section>
<div class="box-firstline">
<div style="float:left;margin-right:25px;">
<label for="idmurid">ID Murid</label> <br />
<input type="text" name="idmurid" class="input-box2" placeholder="ID Murid" required>
</div>
<div style="float:left;">
<label for="namamurid">Nama Murid</label> <br />
<input type="text" name="namamurid" class="input-box3" placeholder="Nama Murid" required>
</div>
</div>
<br style="clear:both;" />
</section>
<div class="box-secondline">
<div style="float:left;margin-right:25px;">
<label for="namakelas">Nama Kelas</label> <br />
<input type="text" name="namakelas" class="input-box2" placeholder="Nama Kelas" required>
</div>
<div style="float:left;">
<label for="katalaluan_murid">Kata Laluan</label> <br />
<input type="password" name="katalaluan_murid" class="input-box3" placeholder="Katalaluan" required>
</div>
<br style="clear:both;" />
</div>
</div>
</div>
</body>
I took the code you posted, removed the ::placeholder padding and then added
input[type="text"] {
padding-left: 10px;
}
input[type="password"] {
padding-left: 10px;
}
And it adjusted the the text to match the placeholder.
Here is the full CSS:
.registerbox {
width: 500px;
height: 450px;
background: rgba(255, 255, 255, 0.7);
margin: 10px auto;
border-radius: 20px;
box-shadow: 0 0 40px 10px rgba(0, 0, 0, 0.6);
color: white;
}
input[type="text"] {
padding-left: 10px;
}
input[type="password"] {
padding-left: 10px;
}
.inner-registerbox {
position: relative;
width: 100%;
height: 100%;
}
.registerbox-front {
position: absolute;
height: 100%;
width: 100%;
padding: 55px;
box-sizing: border-box;
border-radius: 14px;
}
input label {
display: block;
}
.registerbox h2 {
text-align: center;
font-size: 25px;
font-weight: normal;
margin-bottom: 20px;
margin-top: 0;
color: black;
}
.input-box2 {
width: 95%;
background: transparent;
border: 1px solid black;
height: 32px;
border-radius: 5px;
padding: 0 0px;
box-sizing: border-box;
outline: none;
text-align: left;
color: black;
display: table;
margin-top: 2px;
margin-bottom: 15px;
}
.input-box3 {
width: 105%;
background: transparent;
border: 1px solid black;
height: 32px;
border-radius: 5px;
padding: 0 0px;
box-sizing: border-box;
outline: none;
text-align: left;
color: black;
display: table;
margin-top: 2px;
margin-bottom: 15px;
}
.box-firstline, .box-secondline {
margin-top: 10px;
}
I'm a new to css and i really can't fix all as i want...
How can i align vertical the h1 to the start of user form?
but most important problem for me is that i can't center good the check and the link, i want it one below the other and centered in the div.
I'm not sure if i have positioned good the div but i want it centred but not too low on the page.
thanks to everyone!
body {
text-align: left;
background-image: url("img/lemon.jpg");
color: #1b1b1b;
}
input[type=text],
input[type=password]{
width: 65%;
display: table;
margin: 0 auto;
padding: 12px 20px;
border: none;
border-bottom: 1px solid darkgray;
background-color: #e9e9e9;
box-sizing: border-box;
margin-bottom: 7px;
resize: vertical;
}
h1 {
font-size: x-large;
}
h2 {
font-size: x-large;
}
button {
background-color: #4CAF50;
color: white;
padding: 7px 20px;
width: 65%;
height: 20%;
display: table;
margin: 0 auto;
border: none;
cursor: pointer;
background: linear-gradient(to bottom, #3d94f6 5%, #1e62d0 100%);
background-color: #3d94f6;
border: 1px solid #337fed;
cursor: pointer;
color: #ffffff;
font-size: 17px;
text-decoration: none;
text-shadow: -1px 1px 1px #1570cd;
}
button:hover {
background: linear-gradient(to bottom, #1e62d0 5%, #3d94f6 100%);
background-color: #1e62d0;
}
button:active {
position: relative;
top: 1px;
}
.container {
width: 35%;
height: auto;
margin-right: auto;
margin-left: auto;
margin-top: 7%;
background-color: white;
box-shadow: 2px 2px 11px rgb(11, 11, 11);
-webkit-box-shadow: 2px 2px 11px rgb(11, 11, 11);
-moz-box-shadow: 2px 2px 11px rgb(11, 11, 11);
overflow: hidden;
}
#check {
display:block;
margin-top: 7px;
}
span.frgt {
margin-top: 7px;
display: block;
}
a {
text-decoration: none;
color: #1e62d0;
}
img {
width: 100%;
height: auto;
opacity: 0.4;
}
<!DOCTYPE html>
<head>
</head>
<body>
<div class="container">
<h1>Login</h1>
<input type="text" placeholder="Username" name="uname" required>
<input type="password" placeholder="password" name="psw" required>
<button type="submit">Login</button>
<hr>
<label id="check">
<input type="checkbox" checked="checked" name="remember"> Remember me
</label>
<span class="frgt">forgot password?</span>
</div>
</body>
</html>
If you set the h1 to the same width of the button and use "margin: 0 auto" to center it, this will make the h1 span the width of the button, and by default the text will be left aligned to the start of the button.
h1 {
font-size: x-large;
width: 65%;
margin: 0 auto;
}
I'm not too sure exactly what you want to do with the check section. If you use "text-align: center", this will center it, or use the same code as above to align it with the buttons.
you can use text-align: center; and vertical-align:top;
If your problem still exists, please explain more clearly what you want.
Use text-align: center; to center text within container.
To make it easier to align your elements, just wrap them into one div and adjust the div with CSS instead of dealing with each single element.
Here is an example of what you can do.
body {
text-align: left;
background-image: url("img/lemon.jpg");
color: #1b1b1b;
}
.form {
width: 75%;
margin: auto;
}
.form-bottom {
text-align: center;
}
input[type=text],
input[type=password] {
display: table;
margin: 0 auto;
width: 100%;
padding: 12px 20px;
border: none;
border-bottom: 1px solid darkgray;
background-color: #e9e9e9;
box-sizing: border-box;
margin-bottom: 7px;
resize: vertical;
}
h1 {
font-size: x-large;
}
h2 {
font-size: x-large;
}
button {
background-color: #4CAF50;
color: white;
padding: 7px 20px;
height: 20%;
width: 100%;
display: table;
margin: 0 auto;
border: none;
cursor: pointer;
background: linear-gradient(to bottom, #3d94f6 5%, #1e62d0 100%);
background-color: #3d94f6;
border: 1px solid #337fed;
cursor: pointer;
color: #ffffff;
font-size: 17px;
text-decoration: none;
text-shadow: -1px 1px 1px #1570cd;
}
button:hover {
background: linear-gradient(to bottom, #1e62d0 5%, #3d94f6 100%);
background-color: #1e62d0;
}
button:active {
position: relative;
top: 1px;
}
.container {
width: 35%;
height: auto;
margin-right: auto;
margin-left: auto;
margin-top: 7%;
background-color: white;
box-shadow: 2px 2px 11px rgb(11, 11, 11);
-webkit-box-shadow: 2px 2px 11px rgb(11, 11, 11);
-moz-box-shadow: 2px 2px 11px rgb(11, 11, 11);
overflow: hidden;
}
#check {
display: block;
margin-top: 7px;
}
span.frgt {
margin-top: 7px;
display: block;
}
a {
text-decoration: none;
color: #1e62d0;
}
img {
width: 100%;
height: auto;
opacity: 0.4;
}
<body>
<div class="container">
<div class="form">
<h1>Login</h1>
<input type="text" placeholder="Username" name="uname" required>
<input type="password" placeholder="password" name="psw" required>
<button type="submit">Login</button>
</div>
<hr>
<div class="form-bottom">
<label id="check">
<input type="checkbox" checked="checked" name="remember"> Remember me
</label>
<span class="frgt">forgot password?</span>
</div>
</div>
</body>
What i am doing is that in search box when user enter a search term, i display a close button ('x' character to be specific, embedded as content after reset button) to clear the contents of search box.
It works fine in both Chrome and IE but not in firefox.
Any kind of help would be highly appreciated.
.search-box,.close-icon,.search-wrapper {
position: relative;
padding: 10px;
}
.search-wrapper {
width: 500px;
margin: auto;
margin-top: 50px;
}
.search-box:focus {
box-shadow: 0 0 15px 5px #b0e0ee;
border: 2px solid #bebede;
}
.close-icon {
border:1px solid transparent;
background-color: transparent;
display: inline-block;
vertical-align: middle;
outline: 0;
cursor: pointer;
}
.close-icon:after {
content: "X";
display: block;
width: 15px;
height: 15px;
position: absolute;
z-index:1;
right: 35px;
top: 0;
bottom: 0;
margin: auto;
padding: 2px;
border-radius: 50%;
text-align: center;
color: black;
font-weight: normal;
font-size: 12px;
cursor: pointer;
}
.search-box:not(:valid) ~ .close-icon {
display: none;
}
<div class="search-wrapper">
<form>
<input type="text" name="focus" required class="search-box" placeholder="Enter search term" />
<button class="close-icon" type="reset"></button>
</form>
</div>
This code should help you
.search-box,.search-wrapper {
position: relative;
padding: 10px;
}
.search-wrapper {
width: 500px;
margin: auto;
margin-top: 50px;
}
.search-box
{
width:300px;
}
.search-box:focus {
box-shadow: 0 0 15px 5px #b0e0ee;
border: 2px solid #bebede;
}
.close-icon {
border:1px solid transparent;
background-color: transparent,
display: inline-block;
vertical-align: middle;
outline: 0;
position: absolute;
top:19px;
left:305px;
z-index:1;
padding: 1px 2px;
border-radius: 50%;
text-align: center;
color: black;
font-weight: normal;
font-size: 12px;
cursor: pointer;
}
.search-box:not(:valid) ~ .close-icon {
display: none;
}
<div class="search-wrapper">
<form>
<input type="text" name="focus" required class="search-box" placeholder="Enter search term" />
<button class="close-icon" type="reset">X</button>
</form>
</div>
NOTE : set your .search-box width and according to it set left of your .close-icon
Try this code: Hope this solve your problem. Adjust "outer_box" class for width.
<style>
.search-box, .search-wrapper {
padding: 10px;
box-sizing: border-box;
}
.search-box {
position:relative;
width:100%;
}
.outer_boxs{
position:relative;
width:60%;
}
.search-wrapper {
width: 500px;
margin: auto;
margin-top: 50px;
}
.search-box:focus {
box-shadow: 0 0 15px 5px #b0e0ee;
border: 2px solid #bebede;
}
.close-icon {
border:1px solid transparent;
background-color: transparent,
display: inline-block;
vertical-align: middle;
outline: 0;
cursor: pointer;
position: absolute;
right:5px;
top: 10px;
background:#f2f2f2;
}
.search-box:not(:valid) ~ .close-icon {
display: none;
}
</style>
<div class="search-wrapper">
<form>
<div class="outer_boxs" >
<input type="text" name="focus" required class="search-box" placeholder="Enter search term" />
<button class="close-icon" type="reset">X</button>
</div>
</form>
</div>
How I can delete empty space between search input box and the go button? I've prepared jsfiddle with code sample. Link - jsFiddle
Screenshot:
HTML:
<div class="blablabla">
<form id="search_mini" action="#" method="get">
<div class="form-search">
<!--<label for="search"></label>-->
<input id="search" value="SEARCH" type="text" name="q" class="input-text" maxlength="128" autocomplete="off">
<button type="submit" title="GO" class="button"><span><span>GO</span></span>
</button>
<div id="search_autocomplete" class="search-autocomplete" style="display: none;"></div>
</div>
</form>
CSS:
#search_mini {
width: 268px;
}
.form-search input {
border-color: #7d7c7c;
height: 30px;
width: 150px;
padding:0;
}
.form-search button.button {
background: url(../images/bg.gif) 0 0 repeat-x;
font-size: 12px;
text-align: center;
padding: 0;
height: 36px;
min-width: 84px;
}
Thank you in advance.
You may try margin-left:
#search_mini {
width: 268px;
}
.form-search input {
border-color: #7d7c7c;
height: 30px;
width: 150px;
padding: 0;
}
.form-search button.button {
background: url(../images/bg.gif) 0 0 repeat-x;
font-size: 12px;
text-align: center;
padding: 0;
height: 36px;
min-width: 84px;
margin-left: -4px;/* put as your need */
}
<div class="blablabla">
<form id="search_mini" action="#" method="get">
<div class="form-search">
<!--<label for="search"></label>-->
<input id="search" value="SEARCH" type="text" name="q" class="input-text" maxlength="128" autocomplete="off">
<button type="submit" title="GO" class="button"><span><span>GO</span></span>
</button>
<div id="search_autocomplete" class="search-autocomplete" style="display: none;"></div>
</div>
</form>
add float:left to you .form-search input element
example: http://jsfiddle.net/2nwp36nj/2/
#search_mini {
width: 268px;
}
.form-search input {
border-color: #7d7c7c;
height: 30px;
width: 150px;
padding:0;
float: left;
}
.form-search button.button {
background: url(../images/bg.gif) 0 0 repeat-x;
font-size: 12px;
text-align: center;
padding: 0;
height: 36px;
min-width: 84px;
}
<div class="blablabla">
<form id="search_mini" action="#" method="get" _lpchecked="1">
<div class="form-search">
<!--<label for="search"></label>-->
<input id="search" value="SEARCH" type="text" name="q" class="input-text" maxlength="128" autocomplete="off">
<button type="submit" title="GO" class="button"><span><span>GO</span></span>
</button>
<div id="search_autocomplete" class="search-autocomplete" style="display: none;"></div>
</div>
</form>
</div>
use float left for both of the elements input and button also you need to give a width for button as well. It looks like it is working in the below code.
http://jsfiddle.net/2nwp36nj/3/
#search_mini {
width: 368px;
}
.form-search input, .form-search button {
border-color: #7d7c7c;
height: 30px;
width: 150px;
padding:0;
float: left;
}
.form-search button.button {
background: url(../images/bg.gif) 0 0 repeat-x;
font-size: 12px;
text-align: center;
padding: 0;
height: 36px;
min-width: 84px;
}
are suggested just such a button then she together with the form DEMO
<form class="form-wrapper cf">
<input type="text" placeholder="search" required>
<button type="submit">GO</button>
</form>
.cf:before, .cf:after{
content:"";
display:table;
}
.cf:after{
clear:both;
}
.cf{
zoom:1;
}
.form-wrapper {
width: 450px;
padding: 15px;
margin: 150px auto 50px auto;
background: #444;
background: rgba(0,0,0,.2);
border-radius: 10px;
box-shadow: 0 1px 1px rgba(0,0,0,.4) inset, 0 1px 0 rgba(255,255,255,.2);
}
.form-wrapper input {
width: 330px;
height: 20px;
padding: 10px 5px;
float: left;
font: bold 15px 'lucida sans', 'trebuchet MS', 'Tahoma';
border: 0;
background: #eee;
border-radius: 3px 0 0 3px;
}
.form-wrapper input:focus {
outline: 0;
background: #fff;
box-shadow: 0 0 2px rgba(0,0,0,.8) inset;
}
.form-wrapper input::-webkit-input-placeholder {
color: #999;
font-weight: normal;
font-style: italic;
}
.form-wrapper input:-moz-placeholder {
color: #999;
font-weight: normal;
font-style: italic;
}
.form-wrapper input:-ms-input-placeholder {
color: #999;
font-weight: normal;
font-style: italic;
}
.form-wrapper button {
overflow: visible;
position: relative;
float: right;
border: 0;
padding: 0;
cursor: pointer;
height: 40px;
width: 110px;
font: bold 15px/40px 'lucida sans', 'trebuchet MS', 'Tahoma';
color: #fff;
text-transform: uppercase;
background: #d83c3c;
border-radius: 0 3px 3px 0;
text-shadow: 0 -1px 0 rgba(0, 0 ,0, .3);
}
.form-wrapper button:hover{
background: #e54040;
}
.form-wrapper button:active,
.form-wrapper button:focus{
background: #c42f2f;
outline: 0;
}
.form-wrapper button:before {
content: '';
position: absolute;
border-width: 8px 8px 8px 0;
border-style: solid solid solid none;
border-color: transparent #d83c3c transparent;
top: 12px;
left: -6px;
}
.form-wrapper button:hover:before{
border-right-color: #e54040;
}
.form-wrapper button:focus:before,
.form-wrapper button:active:before{
border-right-color: #c42f2f;
}
.form-wrapper button::-moz-focus-inner {
border: 0;
padding: 0;
}
Simply add this to your elements :
.form-search input,
.form-search button.button
{
display: block;
float: left;
}
Your space is actually due to a whitespace.
Another working solution: you must insert comment between input tag and button tag. Like this:
<input id="search" value="SEARCH" type="text" name="q" class="input-text" maxlength="128" autocomplete="off"><!--
--><button type="submit" title="GO" class="button"><span><span>GO</span></span>