Input "submit" inside textarea not clickable in Firefox - html

I have a simple form that allows users to send mails to the site's owner. I wouldn't like to change it totally, because I've got already written PHP script for this, and this solution worked fine before I tried to add some styles to it...
The problem is, "Wyślij >" (submit) inside the textarea does not work ONLY in firefox. I can't click it, like the button is somewhere underneath. In Opera, Chrome, Edge, IE - it works just fine. I'm starting to giving up on this. I would appreciate any help, I don't know what's causing this.
JSFiddle: http://jsfiddle.net/c0vz64m1/
HTML code:
<form method="post" action="kontakt.php" id="contactform" style="margin-left:35vw; margin-top:20px;">
<label for="name">Imię<font color="white">*</font>:</label><br>
<input type="text" name="name" id="name" placeholder=" Twoje imię (wymagane)" required /><br>
<label for="email">Email<font color="white">*</font>:</label><br>
<input type="text" name="email" id="email" placeholder=" Twój email (wymagane)" required />
<div id="text-area">
<label for="message">Wiadomość<font color="white">*</font>:</label><br>
<textarea name="message" rows="9" cols="50" id="message" placeholder=" Twoja wiadomość (wymagane)" equired></textarea>
<input type="submit" name="submit" value="Wyślij »" class="submit-button"/></div>
</form>
CSS:
input#name,input#email {
box-shadow:0px 0px 10px skyblue;
border:2px solid skyblue;
border-radius:7px;
padding-left:5px;
transition:all .2s ease-in-out;
}
input#name:focus,input#email:focus {
box-shadow:0px 0px 20px skyblue;
transition:all .2s ease-in-out;
}
input#name:hover,input#email:hover {
box-shadow:0px 0px 20px skyblue;
}
.submit-button {
width:75px;
height:36px;
margin-left:380px;
display:block;
margin-top:-41px;
border-top:2px solid blue;
z-index:5000;
font-size:14pt;
color:skyblue;
font-family:Andada;
}
textarea {
box-shadow:0px 0px 10px skyblue;
border:2px solid skyblue;
border-radius:10px;
resize:none;
height:150px;
width:375px;
z-index:1;
padding-right:75px;
transition:all .2s ease-in-out;
}
textarea:focus {
box-shadow:0px 0px 20px skyblue;
transition:all .2s ease-in-out;
}
textarea:hover {
box-shadow:0px 0px 20px skyblue;
}

Use absolute positioning to put the button over the textarea and it will work.
Remove from class .submit-button these things:
margin-left:380px;
margin-top:-41px;
and add these:
position:absolute;
right: 0;
bottom: 30px;
Then add position:relative to #text-area .

Please see updated fiddle: http://jsfiddle.net/w86o8hhh/ which adds:
z-index:10;
to the CSS, and:
id="submit"
to the submit button

Related

How to show required message on custom inputs label?

UPDATE: I solved the problem by making inputs visible for browser but not for user. Making those changes to CSS worked.
.radio-checked {
opacity:0;
position: absolute;
z-index: -1;
}
QUESTION:
I have custom inputs in my form. I hide them with...
display:none;
...then styling with css to look different.
Example of my codes:
<input id="radio-input" class="radio-check" type="radio" name="odeme">
<label for="radio-input" class="radio-label">Option Name</label>
Here is a fiddle for showing how it works.
https://jsfiddle.net/kjaL1zbd/
Problem is, when you hide the input element the validation message is won't show up. You can see example here:
https://jsfiddle.net/kjaL1zbd/1/
So is there any way to show this message on the label? Or is there any solution for this?
/* RADIO CUSTOM */
form {
position: relative;
display: block;
}
.radio-check {
//visibility:collapse;
margin-left: 22px;
}
.test {
margin-left: 110px;
}
.radio-label {
position:absolute;
padding-left:20px;
//margin:10px 40px 10px 0px;
cursor:pointer;
left:20px;
}
.radio-label:before {
content:"";
display:block;
width:15px;
height:15px;
background-color:#fff;
border:1px solid #ddd;
border-radius:100px;
top:0;
left:0px;
position:absolute;
-webkit-transition:all .2s ease;
transition:all .2s ease;
}
.radio-label:hover:before{
border:1px solid #4198d3;
}
input[type="radio"]:checked + .radio-label:after {
content:"";
width:11px;
height:11px;
display:block;
position:absolute;
top:3.3px;
left:3.3px;
background-color:#4498ff;
background-repeat:no-repeat;
background-position:center;
background-size:11px;
border-radius:100px;
}
form{
margin:50px 0;
}
<form>
<input id="ben" class="radio-check" type="radio" name="odeme" required>
<label for="ben" class="radio-label">Option Name</label>
<input type="submit" class="test">
</form>
Click submit button to see the problem. Top is custom, bottom is default.
<form>
<input id="ben" type="radio" name="odeme" required>
<label for="ben" >Option Name</label>
<input type="submit">
</form>

Setting form field label width and align checkbox to right

I'm trying to set a width limit on a input label and at the same time align a styled check to the right.
The below image shows how it currently looks and how I'd like it to look:
This is the HTML I'm using:
<a href='#' class='tooltip' title='tooltip text.'><img src='images/tooltip.png'></a> <b>This is my Text Label:</b></div>
<label class="switch"><input type="checkbox" name='check' id='check' title='checkbox' value="1"><div class="slider"></div></label>
<br/><input type="text" id="textinput" name="textinput" size="40" maxlength="40" autocomplete="off" placeholder="enter text here" value="" tabindex='1' disabled/></div><br/>
I've created a fiddle showing it here:
https://jsfiddle.net/bywgqnrg/1/
Can anyone advise the best way to do this ?
Thanks
Here's a possible solution, I added a fieldwrap to wrap the whole content and sets a fixed width and floated the switch to right check the code below:
.switch { position:relative; display:inline-block; width:53px; height:19px }
.switch input { display:none }
.slider { position:absolute; cursor:pointer; top:0; left:0; right:0; bottom:0; background-color:#ccc; -webkit-transition:.4s; transition:.4s }
.slider:before { position:absolute; content:""; height:11px; width:19px; left:4px; bottom:4px; background-color:#fff; -webkit-transition:.4s; transition:.4s }
input:checked+.slider { background-color:#008c00 } input:focus+.slider { box-shadow:0 0 1px #2196F3 }
input:checked+.slider:before { -webkit-transform:translateX(26px); -ms-transform:translateX(26px); transform:translateX(26px) }
input, select, textarea {border: 1px solid #A0A0A0; background: #FFF; padding: 3px 4px; color: #222; margin: 2px 5px 2px 0px; }
input:focus, select:focus, textarea:focus { outline: none;}
.fieldwrap { width : 320px; overflow : hidden; }
.fieldwrap .switch {float : right;}
<div class="fieldwrap">
<a href='#' class='tooltip' title='tooltip text.'><img src='images/tooltip.png'></a> <b>This is my Text Label:</b>
<label class="switch"><input type="checkbox" name='check' id='check' title='checkbox' value="1"><div class="slider"></div></label>
<div><input type="text" id="textinput" name="textinput" size="40" maxlength="40" autocomplete="off" placeholder="enter text here" value="" tabindex='1' disabled/></div>
</div>

some css properties arn't working

this is my page code sample
<body>
<div id="header">
<?php
include 'includes/header.php';
?>
</div>
<div id="loginpage">
<div class="data">
<h5><?php echo $errors ;?></h5>
<form class="loginform" action="login.php" method ="post">
<h5>UserName:</h5>
<input type="text" name="username" id="s" placeholder="username" required="required"/><br>
<h5>Password:</h5>
<input type="password" name="password" id="s" placeholder="password" />
<br>
<input type="submit" id="searchSubmit" value="submit" />
</form>
</div>
<img src="login.jpg" width="400px" height="380px"/>
</div>
<?php
include 'includes/footer.php';
?>
</body>
and this is my css rule
#loginpage
{
width:100%;
height:auto;
background:white;
display:-moz-box;
-moz-box-orient:horizontal;
position:relative;
}
.data {
width:300px;
height:250px;
margin:50px;
margin-top:100px;
padding:10px ;
text-align:left;
background:#e8fccc;
position:relative;
box-shadow: 0px 0px 5px 1px rgb(0,0,0 0.1) ;
}
#loginpage img{
margin:50px;
border-radius:10px;
box-shadow: 0px 0px 5px 1px rgb(0,0,0 0.1) ;
}
.loginform{
margin-top:50px;
}
now problem is css nt working properly in div data(class)
i defined its height 250px bt it is taking the same height of the img tag.
height is changing when i am incresing or decresng the height of img tag
If you don't want it to take shape of the elements inside add overflow:hidden; to the .input class
Also, you have to add # in front of your color or it won't work.
so black 000000 should be #000000 without the # it's no good.
also this is bad practice
margin:50px; margin-top:100px;
if you want 50px margin all around and 100px just on the top you should do margin:100px 50px 50px 50px thats top right bottom left.
Remove class="input" in that div <div class="input">
And use
input { //without the dot
width:300px;
height:250px;
margin:50px;
margin-top:100px;
padding:10px ;
text-align:left;
background:e8fccc;
position:relative;
box-shadow: 0px 0px 5px 1px rgb(0,0,0 0.1) ;
}

Change search form button text to image

I can't seem to get my head around the following problem. So I procured a template of a search form which I then changed to fit my design requirements but I can't seem to be able to change the value=s bit to an image of a search box button. Please see http://jsfiddle.net/p9URB/. The code is as follows:
HTML
<form action="/search" method="get" id="search_form" class="clearfix voicetron" data-ds-protection="enabled">
<div id="search_holder">
<input type="text" id="search_field" name="q" value="" title="Enter search term" placeholder="Search" data-validators="required" data-speech-enabled="" data-search-engine="oracle" x-webkit-speech="x-webkit-speech" autocomplete="off">
<input type="text" id="search_suggest" value="" placeholder="" disabled="">
<input type="submit" value="y" data-submit-text="s" class="btn_search iconify" title="Search">
</div>
</form>
CSS
#search_form{
position:relative;
margin:10px 0;
float:right
}
#search_form #search_holder{
display:block
}
#search_form #search_holder input[type="text"]{
font-size:13px;
width:180px;
height:26px;
margin:0;
position:absolute;
right:0;
padding:0 32px 0 6px
}
#search_form #search_holder #search_field{
z-index:3;
border:1px solid #C9C9C9;
background:url("") #fff;
-webkit-border-radius:5px;
-moz-border-radius:5px;
-o-border-radius:5px;
-ms-border-radius:5px;
border-radius:5px;
text-shadow:0 0 1px #fff
}
#search_form #search_holder #search_field:focus,#search_form #search_holder #search_field:hover{
border-color:#acb1b4;
color:#123
}
#search_form #search_holder #search_field:-moz-placeholder{
color:#a6a7a8
}
#search_form #search_holder #search_field::-webkit-input-placeholder{
color:#a6a7a8
}
#search_form #search_holder #search_field:-moz-placeholder{
color:#a6a7a8
}
#search_form #search_holder #search_suggest{
z-index:2;
border:none;
background:#fff;
border:1px solid #fff;
-webkit-border-radius:5px;
-moz-border-radius:5px;
-o-border-radius:5px;
-ms-border-radius:5px;
border-radius:5px;
color:#9da2a8
}
#search_form #search_holder .overTxtLabel{
z-index:113
}
#search_form .active{
color:#fff;
background:#a6a7a8
}
#search_form .btn_search{
z-index:3;
position:absolute;
top:4px;
right:1px;
display:block;
color:#a6a7a8;
width:28px;
height:21px;
font-size:17px;
line-height:21px;
text-align:center;
font-weight:400;
background:0 0;
border:0;
border-left:1px dotted #a6a7a8
}
#search_form .btn-anchor{
background:0 0;
border:0;
border-bottom:1px solid #ccc;
color:#666;
margin:0 10px;
font-size:10px;
padding-bottom:2px;
font-weight:400
}
#search_form.voicetron [name="q"]{
padding-right:34px;
width:170px;
line-height:17px
}
#search_form.voicetron .btn_search{
color:#71767a
}
You can use an input type of image as your submit button:
<input type="image" src="/my/image/location.png" />
Instead of styling up a submit button. As far as I know, the input type of image replicates the submit behaviour of a submit button.
Add this to btn_search iconify class of css and specify an image.
background: url("your_url.png") no-repeat scroll 0 0 transparent;
You have set input value="s" so change it to value="" and add background image for that button
#search_form.voicetron .btn_search{
color:#71767a;
background-image:url('http://findicons.com/files/icons/1389/g5_system/16/toolbar_find.png');
background-repeat:no-repeat;
}
Js Fiddle
You can simply treat the button as a block element and remove the text with
text-indent:-9999px;
then set a background image.
You probably also want to add
cursor:pointer;
As it doesn't look like a button at the moment.

Adding style to file upload button in css

I have a text field and button with following css:
JS fiddle link : http://jsfiddle.net/Tdkre/
.submit {
-moz-box-shadow:inset 0px 1px 0px 0px #cae3fc;
-webkit-box-shadow:inset 0px 1px 0px 0px #cae3fc;
box-shadow:inset 0px 1px 0px 0px #cae3fc;
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #79bbff), color-stop(1, #4197ee) );
background:-moz-linear-gradient( center top, #79bbff 5%, #4197ee 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#79bbff', endColorstr='#4197ee');
background-color:#79bbff;
-moz-border-radius:6px;
-webkit-border-radius:6px;
border-radius:6px;
border:1px solid #469df5;
display:inline-block;
color:#ffffff;
font-family:arial;
font-size:14px;
font-weight:bold;
padding:5px 14px;
text-decoration:none;
text-shadow:1px 1px 0px #287ace;
cursor:pointer;
}
.submit:hover {
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #4197ee), color-stop(1, #79bbff) );
background:-moz-linear-gradient( center top, #4197ee 5%, #79bbff 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#4197ee', endColorstr='#79bbff');
background-color:#4197ee;
}
.submit:active {
position:relative;
top:1px;
}
.text-input {
padding: 6px;
font-size: 13px;
border: 1px solid #d5d5d5;
color: #333;
border-radius: 4px 4px 4px 4px !important;
}
<form>
<input type="text" class="text-input" size="40"/>
<input type="button" value="Upload" id="upload" class="submit"/>
</form>
I want to add the same style to the file upload input type. I am a css beginner. How can i use this style to file upload button?
Try this solution: http://jsfiddle.net/JJRrc/1/
Html
<p class="form">
<input type="text" id="path" />
<label class="add-photo-btn">upload
<span>
<input type="file" id="myfile" name="myfile" />
</span>
</label>
</p>
CSS
.form input[type="file"]{
z-index: 999;
line-height: 0;
font-size: 50px;
position: absolute;
opacity: 0;
filter: alpha(opacity = 0);-ms-filter: "alpha(opacity=0)";
cursor: pointer;
_cursor: hand;
margin: 0;
padding:0;
left:0;
}
.add-photo-btn{
position:relative;
overflow:hidden;
cursor:pointer;
text-align:center;
background-color:#83b81a;
color:#fff;
display:block;
width:197px;
height:31px;
font-size:18px;
line-height:30px;
float:left;
}
input[type="text"]{
float:left;
}
JQuery
$('#myfile').change(function(){
$('#path').val($(this).val());
});
I tried this it looks pretty good to me. Are there any flaws with this?
Here is the jsfiddle link http://jsfiddle.net/Tdkre/1/
#FileUpload {
position:relative;
}
#BrowserVisible {
position: absolute;
top: 0px;
left: 0px;
z-index: 1;
background:url(upload.png) 100% 1px no-repeat;
width:345px;
height:30px;
}
#FileField {
width:250px;
margin-right:85px;
padding: 6px;
font-size: 13px;
background: #fff url('bg-form-field.gif') top left repeat-x;
border: 1px solid #d5d5d5;
color: #333;
border-radius: 4px 4px 4px 4px !important;
}
#BrowserHidden {
position:relative;
width:345px;
height:30px;
text-align: right;
-moz-opacity:0;
filter:alpha(opacity: 0);
opacity: 0;
z-index: 2;
}
<div id="FileUpload">
<input type="file" size="24" id="BrowserHidden" onchange="getElementById('FileField').value = getElementById('BrowserHidden').value;" />
<div id="BrowserVisible"><input type="text" id="FileField" /></div>
Here are the images
You could also use jQuery, like this:
<img id="image" style="cursor:pointer;" src="img.jpg" />
<input type='file' style="display:none;" name="photosubmit" id="photosubmit"/>
And this jquery code
$("#image").click(function(){
$("#photosubmit").click();
});
Hopes this helps someone too!
try this:
In your css file put this on the end of file or somewhere else: input[type="file"]::-webkit-file-upload-button.
This syntax is only for button style.
If you put there only: input[type="file"] you can style the array where you have filename.
It is notoriously hard to style file upload buttons, but if you are willing to use jQuery and a plugin I've found this one to be very useful.
It gives you the posibility to "fake" file upload button functionality on any DOM element, so you can style it any way you want. Works well in all major browsers including old IE versions.
I run this relatively short jQuery on my page that contains one or more unaltered html <input type="file"> elements.
The jQuery will hide the elements and insert new ones where appropriate that mimic the same behaviour.
This answer is similar to others on the page but has been tested in IE browsers as well as the ones whose developer's actually take the time to support carefully considered web standards.
$(document).ready(function(){
// replace all file upload elements for styling purposes
$('input[type="file"]').each(function(){
var btn = $('<button class="file">Browse...</button>');
var txt = $('<span class="file"></span>');
$(this).after(txt).after(btn);
$(this).css({display:'none'});
var target = this;
$(btn).click(function(ev){
ev.preventDefault();
$(target).click();
})
$(target).change(function(){
// IE uses a stupid renaming scheme that includes "fake-path"
var fname = $(target).val()
$(txt).html(fname.substr(fname.lastIndexOf('\\')+1));
});
});
});
Now you just need to style button.file and span.file as you like and you are good to go.
Here is a link. You can change style of button.
HTML
<button>upload</button>
<input type="text" id="f" disabled="disabled" />
<input id="html_btn" type='file' " /><br>
CSS
button {
border-radius:10px;
padding:5px;
}
#html_btn {
display:none;
}
Javascript
$('button').bind("click", function () {
$('#html_btn').click();
});
$('#html_btn').change(function () {
document.getElementById("f").value = $('#html_btn').val();
});
Simple Solution: Custom file upload button with css only
.fileUpload input[type=file]{
display:none;
}
.btn{
background-color:#e3e3e3;
color:#333;
border:1px solid #e6e6e6;
border-radius:3px;
padding:6px 12px;
font-size:16px;
}
<label class="btn fileUpload btn-default">
Browse <input type="file" hidden="">
</label>
You can use pseudo attribute to apply css to upload button.
<input type="file"/>
input::-webkit-file-upload-button
{
background:blue;
color:white;
/* like this add your style */
}
Please enable show user agent shadow DOM to inspect shadow elements
Go to Browser >> DevTool (F12) >> settings >> Preferences >> Elements