Hide input image URL - html

Am using the following code to change look of input file type, i just changed input select type as image and my problem is How can i hide input image URL
HTML
<form action="for.php" method="POST" enctype="multipart/form-data">
<input type="file" name="files[]" multiple id="files" class="hidden"/>
<input type="submit" id="sub"/>
</form>
CSS
input[type="file"] {
border: 1px gray dashed;
background:no-repeat center gainsboro;
text-indent: -9999em;
line-height:3000;
width: 128px;
height: 128px;
}
How do i hide image name after selected

Just skip above code and use following code
HTML
<form action="for.php" method="POST" enctype="multipart/form-data">
<div class="inputWrapper">
<input type="file" name="files[]" multiple id="files" class="hidden fileInput"/>
</div>
<input type="submit" id="sub">
</form>
CSS
.inputWrapper {
overflow: hidden;
position: relative;
cursor: pointer;
background-color: #DDF;
border: 1px gray dashed;
background: url('file_add.png') no-repeat center gainsboro;
text-indent: -9999em;
width: 200px;
height: 200px;
}
.fileInput {
cursor: pointer;
height: 100%;
position:absolute;
top: 0;
right: 0;
font-size:50px;
}
.hidden {
opacity: 0;
-moz-opacity: 0;
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0)
}
OUTPUT

Related

Web page not responsive even with use of Bootstrap and not using px

I understand that this question has been asked countless amounts of times, however I still haven't found a working response!
Here is the site on my resolution (1440 x 900):
And here is the site on a friend's resolution (1920 x 1080):
https://gyazo.com/7bbdd9dd9119059f1ca65c034560abc6
I can't seem to understand why this is happening! I have literally tried everything. I've tried vw and vh, percentages as well as bootstrap stuff and to no avail at all.
HTML Code:
<div class="form-control" style="background-color: transparent;border-style: none;">
<form class="loginform" action="loginprocess.php" method="post">
<div class="form-group">
<label class="labels" for="uname">Username</label>
<input class="usernameinput" type="text" name="username" id="uname">
</div>
<div class="form-group">
<label class="labels" for="pwd">Password</label>
<input class="passwordinput" type="password" name="password" id="pwd">
</div>
<div class="form-group">
<input type="image" class="loginbutton" src="assets/img/login.png" onclick="PlaySound()">
</div>
</form>
CSS Code
.backbutton {
position:relative;
left:1%;
top:1%;
width:2%;
height:4%;
opacity:0.5;
}
.loginform {
position:relative;
left: 40vw;
top:33vh;
width:25vw;
}
input[type=text] {
width: 28.7vw;
}
input[type=password] {
width: 28.7vw;
}
.loginbutton {
position:relative;
left:19.25vw;
top:1vh;
max-width: 40%;
height: 35%;
}
.labels {
color:white;
position:relative;
left: -11vw;
top: 6vh;
font-family: 'Chakra Petch', sans-serif;
font-size: 200%;
}
Thank you so much for reading! I hope someone can help me out with this :)
If it is that you want the login form to remain in the middle, both vertically and horizontally for any screen.
You could surround the form with a container and apply
display: flex;
position: fixed;
overflow: auto;
align-items: center;
justify-content: center;
top: 0;
left: 0;
bottom: 0;
right: 0;
Here is a snippet, although if you are using Bootstrap then you may want to look at their use of jumbotron as seen here jumbotron
body {
margin: 0;
}
main {
display: flex;
position: fixed;
overflow: auto;
align-items: center;
justify-content: center;
top: 0;
left: 0;
bottom: 0;
right: 0;
background: blue !important;
}
form {
background: rgba(0, 0, 0, 0.8);
padding: 2em;
border-radius: 10px;
margin: 0 auto;
}
.form-group {
display: flex;
margin-top: 20px;
}
.form-group:first-child {
margin-top: 0px;
}
label {
color: #ffffff;
margin-right: 10px;
min-width: 90px;
}
input {
width: 100%;
}
input[type=image] {
height: 30px;
width: auto;
}
<body>
<main>
<form class="loginform" method="post">
<div class="form-group">
<label for="uname">Username</label>
<input type="text" name="username" id="uname">
</div>
<div class="form-group">
<label for="pwd">Password</label>
<input type="password" name="password" id="pwd">
</div>
<div class="form-group">
<input type="image" src="https://www.freeiconspng.com/uploads/login-button-png-13.png">
</div>
</form>
</main>
</body>

how to place text over an <input type = "image" /> element?

I can not write on over, I tried in several ways, but it still did not work, how do I do it?
I believe this is different because it is <input type="image"> and not <img> !
I want position the text on the image at the bottom
.centered {
position: absolute;
top: 95%;
left: 50%;
transform: translate(-50%, -50%);
color: red;
}
<div class="centered ">Example
<input type="image" id="MY_ID" src="img.png" class="btTxt submit " width="100" height="130" />
</div>
Don't try put an image on the input itself, use a wrapping div and add the image to that.
HTML
<div class="inputbutton">
<span class="text">Hello World!</span>
<input type="submit" class="btTxt submit" name="" value="">
</div>
CSS
div.inputbutton {
position: relative;
display: inline-block;
}
div.inputbutton input {
background: url('http://placehold.it/200x100') no-repeat;
cursor: pointer;
width: 200px;
height: 100px;
border: none;
}
span.text {
position: absolute;
bottom: 10px;
right: 10px;
}
JSFiddle:
https://jsfiddle.net/msyhoaak/18/

Place question mark submit button inside input field

I have an input field and a submit button which looks like a question mark due to css styling. This is what it currently looks like:
How can I position the question mark inside the input field like this:
HTML
<div class="div">
<form method="post">
<input type="text" class="input">
<input type="submit" value="?" class="submit">
</form>
</div>
CSS
.div {
position: relative;
top: 50%;
transform: translateY(50%);
}
.input {
display: block;
margin: 0 auto;
width: 50%;
}
.submit {
background: none;
border: none;
}
JsFiddle: https://jsfiddle.net/TheCodesee/8h72tjcL/2/
You could use the question mark as a background image in the input field with some CSS, e.g.:
.form-input {
padding-right: 4rem;
background-image: url(your image);
background-repeat: no-repeat;
background-position: center right 1rem;
background-size: 2rem 2rem;
}
You may need to adjust the numbers depending on your image size of course. Your submit button may still exist, but you want to hide (via visibility or display). Thus, the use can still hit enter to submit the form.
Another possibility would be to auto submit the form on input blur.
Like that, you can avoid moving the button itself around.
Use position: absolute on your submit input.
.div {
position: relative;
top: 50%;
transform: translateY(50%);
width: 50%;
margin: 0 auto;
}
.input {
display: block;
margin: 0 auto;
width: 100%;
}
.submit {
border: none;
background: none;
outline: none;
position: absolute;
top: 2px;
right: 0px;
}
<div class="div">
<form method="post">
<input type="text" class="input">
<input type="submit" value="?" class="submit">
</form>
</div>

show name of file on custom input field

i am using a custom file input on an upload page on my website and it is working as per my requirement the only issue is i have hidden the default layout of filetype="input" but i want to show the name of the file being uploaded so that the user may know which file he has uploadedand the name of the file here's the fiddle
JsFiddle
here's the html and css
<div class="custom-upload">
<div class="fake-file">
<input placeholder="Choose File" type="file" name="fileToUpload" id="fileToUpload" />
</div>
</div>
.custom-upload {
position: relative;
height: 40px;
width: 100%;
margin-top: 20px;
border-bottom: 1px solid #625f5b;
}
.custom-upload input[type=file]
{
outline:none;
position: relative;
text-align: right;
-moz-opacity:0 ;
filter:alpha(opacity: 0);
opacity: 0;
z-index: 2;
width:100%;
height:100%;
}
.custom-upload .fake-file
{
background:url(https://s4.postimg.org/hy3g354ot/upload.png) center right no-repeat;
position: absolute;
top: 0px;
left: 0px;
width: 100%;
padding: 0;
margin: 0;
z-index: 1;
line-height: 100%;
}
.custom-upload .fake-file input
{
font-size:16px;
height:40px;
width: 100%;
}
Look at the JavaScript I added.
Note: I used jQuery. If you are using native JavaScript, I have to change the code
$(function(){
$("#fileToUpload").on('change',function(){
fpath = $(this).val();
$('#filePath').html('<b>You selected the file:</b> ' + fpath);
});
});
.custom-upload {
position: relative;
height: 40px;
width: 100%;
margin-top: 20px;
border-bottom: 1px solid #625f5b;
}
.custom-upload input[type=file]
{
outline:none;
position: relative;
text-align: right;
-moz-opacity:0 ;
filter:alpha(opacity: 0);
opacity: 0;
z-index: 2;
width:100%;
height:100%;
}
.custom-upload .fake-file
{
background:url(https://s4.postimg.org/hy3g354ot/upload.png) center right no-repeat;
position: absolute;
top: 0px;
left: 0px;
width: 100%;
padding: 0;
margin: 0;
z-index: 1;
line-height: 100%;
}
.custom-upload .fake-file input
{
font-size:16px;
height:40px;
width: 100%;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="custom-upload">
<div class="fake-file">
<input placeholder="Choose File" type="file" name="fileToUpload" id="fileToUpload" />
</div>
<div id="filePath">
</div>
</div>
Another choise could be without using jquery, but pure javascript. This is my solution.
<span id='filename'></span>
<div class="custom-upload">
<div class="fake-file">
<input placeholder="Choose File" type="file" name="fileToUpload" id="fileToUpload" />
</div>
</div>
<script>
document.getElementById('fileToUpload').addEventListener('change', function() {
var dest = document.getElementById('filename');
dest.innerHTML = document.getElementById('fileToUpload').value;
});
</script>
I let you the personalization of css of the elements to fit your needs.
Hope this help.

elements don't shine through overlay

I want to create an overlay, which is shown, when an edit button is clicked. Only the edit fields should be visible through the overlay.
I have this div at the end of my html:
<div class='overlay closed'></div>
with following css:
.closed
{
display: none;
}
.overlay {
position: fixed;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
background-color: black;
opacity: 0.3;
z-index: 70;
}
This correctly shows an overlay over the website.
I have several forms, which should be accesible while the overlay is visible.
For example:
<div class='edit-container closed'>
<form action="#" method='post'>
<textarea></textarea>
<input type='submit' value="safe" />
<input type='reset' value='cancel' />
</form>
</div>
i have tried following css to put those divs over the overlay:
#content.project .edit-container {
z-index: 71;
}
#content.project .edit-container * {
z-index: 71;
}
Can you tell me why, or what I am doing wrong?
Thanks in advance.
You need a position:relative; on edit-container
http://jsfiddle.net/hwh0nnxo/
HTML
<div class='edit-container'>
<form action="#" method='post'>
<textarea></textarea>
<input type='submit' value="safe" />
<input type='reset' value='cancel' />
</form>
</div>
<div class='overlay'></div>
CSS
.closed {
display: none;
}
.overlay {
position: fixed;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
background-color: black;
opacity: 0.3;
z-index: 70;
}
.edit-container{
position: relative;
z-index: 71;
}