I want to replace my File Field with Image Icon. Because File Field Doesn't looks cool.
Take a Look at this Camera Icon. When someone clicks this Icon, Browse Window Opened up :
Here is JsFiddle DEMO:
http://jsfiddle.net/8aJb4/2/
Here is my CODE:
HTML:
<div class="container">
<input type="file" name="image_src" id="image_src" >
</div>
CSS:
.container{
width:500px;
border:black solid 1px;
text-align:center;
padding:4px;
}
Here is the link to Image Icon:
http://postimg.org/image/rg17ffpxh/
Here's a Fiddle
<div class="container">
<span class="select-wrapper">
<input type="file" name="image_src" id="image_src" />
</span>
</div>
.container{
width: 500px;
border: 1px solid #333;
padding: 4px;
}
.select-wrapper {
background: url(http://s10.postimg.org/4rc0fv8jt/camera.png) no-repeat;
background-size: cover;
display: block;
position: relative;
width: 33px;
height: 26px;
}
#image_src {
width: 26px;
height: 26px;
margin-right: 100px;
opacity: 0;
filter: alpha(opacity=0); /* IE 5-7 */
}
HTML
<script>
function upload(){
document.getElementById("image_src").click();
}
</script>
<div class="container">
<img id="img" src="http://postimg.org/image/rg17ffpxh/" onclick="upload()" alt="hello"/>
<input type="file" name="image_src" id="image_src" />
</div>
CSS
.container{
width:500px;
border:black solid 1px;
text-align:center;
padding:4px;
}
#image_src {
position:absolute;
left:-9999px;
}
#img { cursor:pointer; }
I didn't get your image link to work but here is jsfiddle
it is simple, you just define a file element as hidden and also define an img tag with your own background in it. Write javascript to click the file element programmatically on the click of your img tag. something like this:
<input type="file" name="image_src" id="image_src" hidden='hidden'>
<img src='url' onclick='openWindow()'>
function openWindow(){
document.getElementById("image_src").click
}
Related
I have a circle image that contains multiple image-background 's - an image and a gradient.
I would like to blur only the image and keep the edges of the circle sharp. I use this image a few times in my HTML code and would like to use different levels of blur in each image - Like the example below.
I tried multiple solutions online, but neither of the solutions I found fits to circle edges.
Link to Codepen
img {
width: 1.2em;
height: 1.2em;
padding: 0.3em;
border-radius: 50%;
border: 1px solid #000000;
background-image: radial-gradient(#aac0e8, #b9cde5, #dce6f2);
margin: 0%;
}
.
<div id="natoTarget" class="infoContainer">
<div class="infoTitle">
<img id="imgNatoTarget" src="img\nato.svg" alt="Nato Target">
<label id="labelNatoTarget">NatoTarget</label>
<label id="labelNatoTargetSize">(2.3 x 2.3)</label>
</div>
<div class="parameterContainer">
<div id="natoDetection" class="parameterLine">
<img id="iconNatoDetection" class="svgBlur" src="img\nato.svg" alt="Nato Detection">
<label id="labelNatoDetection" for="inputDetection">Detection: </label>
<output id="inputNatoDetection" name="outputParameter">33</output>
</div>
</div>
<div class="parameterContainer">
<div id="natoRecognition" class="parameterLine">
<img id="iconNatoRecognition" src="img\nato.svg" alt="Nato Recognition">
<label id="labelNatoRecognition" for="inputRecognition">Recognition: </label>
<output id="inputNatoRecognition">33</output>
</div>
</div>
<div class="parameterContainer">
<div id="natoIdentification" class="parameterLine">
<img id="iconNatoIdentification" src="img\nato.svg" alt="Nato Identification">
<label id="labeNatolIdentification" for="inputNatoIdentification">Identification: </label>
<output id="inputNatoIdentification">33</output>
</div>
</div>
</div>
Example:
.
You have to wrap your image inside a container and blur the image inside it and remove borders from image.
<div class="blurContainer">
<img id="iconNatoRecognition" src="/someimage/path.jpg" alt="Nato Recognition">
</div>
CSS:
.parameterContainer .blurContainer {
display: inline-block;
border: 1px solid #000;
border-radius: 50%;
width: 30.78px;
height: 30.78px;
filter: blur(100);
overflow: hidden;
}
.parameterContainer .blurContainer img {
filter: blur(2px);
}
Hope that solves your issue: fiddle: https://jsfiddle.net/r6v9g5un/
You could put the img in a separate div with a border, then apply filter:blur(1px) to the img
HTML:
<div class="infoTitle">
<div class="circleBorder">
<img id="imgNatoTarget" src="img\nato.svg" alt="Nato Target">
</div>
<label id="labelNatoTarget">NatoTarget</label>
<label id="labelNatoTargetSize">(2.3 x 2.3)</label>
</div>
CSS:
.circleBorder{
border: 2px solid #000000
}
img {
width: 1.2em;
height: 1.2em;
padding: 0.3em;
border-radius: 50%;
border: 1px solid #000000;
background-image: radial-gradient(#aac0e8, #b9cde5, #dce6f2);
margin: 0%;
filter: blur(4px);
}
You need to create a wrapper with background over the image and add a filter property to the image:
It would look like this:
HTML
<div class="parameterContainer">
<div id="natoDetection" class="parameterLine">
<div class="imageBackground">
<img id="iconNatoDetection" class="svgBlur" src="img\nato.svg" alt="Nato Detection">
</div>
<label id="labelNatoDetection" for="inputDetection">Detection: </label>
<output id="inputNatoDetection" name="outputParameter">33</output>
</div>
</div>
CSS
.imageBackground {
width: 1.2em;
height: 1.2em;
padding: 0.3em;
border-radius: 50%;
border: 1px solid #000000;
background-image: radial-gradient(#aac0e8, #b9cde5, #dce6f2);
display: inline-block;
}
.svgBlur {
filter: blur(1px);
}
img {
/*Do nothing*/
}
How can I use a div as radio button ?
I mean that :
you can select a div and then it is bordered blue
you can only select one of them
If you want a CSS Only solution, this is an excellent one :
.labl {
display : block;
width: 400px;
}
.labl > input{ /* HIDE RADIO */
visibility: hidden; /* Makes input not-clickable */
position: absolute; /* Remove input from document flow */
}
.labl > input + div{ /* DIV STYLES */
cursor:pointer;
border:2px solid transparent;
}
.labl > input:checked + div{ /* (RADIO CHECKED) DIV STYLES */
background-color: #ffd6bb;
border: 1px solid #ff6600;
}
<label class="labl">
<input type="radio" name="radioname" value="one_value" checked="checked"/>
<div>Small</div>
</label>
<label class="labl">
<input type="radio" name="radioname" value="another" />
<div>Small</div>
</label>
Inspired by this answer
Yes, you can use 'div' as radio button and will work as radio button groups. But for this you'll need Javascript. I've created a script for that using JQuery. Here is the source--
$('.radio-group .radio').click(function(){
$(this).parent().find('.radio').removeClass('selected');
$(this).addClass('selected');
var val = $(this).attr('data-value');
//alert(val);
$(this).parent().find('input').val(val);
});
.radio-group{
position: relative;
}
.radio{
display:inline-block;
width:15px;
height: 15px;
border-radius: 100%;
background-color:lightblue;
border: 2px solid lightblue;
cursor:pointer;
margin: 2px 0;
}
.radio.selected{
border-color: blue;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<h2>Select an option (You will get it's value displayed in the text input field!)</h2>
<form method="post" action="send.php">
<div class="radio-group">
<div class='radio' data-value="One"></div>1
<div class='radio' data-value="Two"></div>2
<div class='radio' data-value="Three"></div>3
<br/>
<input type="text" id="radio-value" name="radio-value" />
</div>
</form>
This is a simple solution.
HTML
<div class="option first">1</div>
<div class="option second">2</div>
<div class="option third">3</div>
<div class="option fourth">4</div>
CSS
.option
{
background-color:red;
margin: 10px auto;
}
.option.active
{
border:1px solid blue;
}
Jquery
$(document).ready(
function()
{
$(".option").click(
function(event)
{
$(this).addClass("active").siblings().removeClass("active");
}
);
});
link
Hello i have been trying a lot to do the pop-up image effect using CSS and CSS3 but the result is nothing i don't know what is the problem, i think it's because of the pseudo-classes don't work with me like (visited,actived and focus etc..) just hover works with me so could anybody help me solve this problem?
what i mean by pop-up image effect is : you know when clicking on an image on Facebook that image is popped up with it's real size and the background is become a little bit more dark?
By the way does anyone know what is the problem with the pseudo-classes why they don't work with me?
thanks
<style type="text/css">
.pop{
border: 1px solid #000 ;
border-radius: 15%;
width: 200px;
height: 200px;
}
.pop:active{
width:500px ;
height:500px;
position:relative;
right: -65px;
top: 200px ;
background-color:#000;
}
<img class='pop' src="C:/Users/mohammad ghazi/Desktop/Xhtml folder/friends.jpg" alt="" />
What you are looking for is called a lightbox. Their are many good tutorials on how to make a pure css one, here is a few of them:
http://andornagy.com/pure-css-image-lightbox/
http://www.designcouch.com/home/why/2013/11/01/responsive-css3-lightbox-with-no-javascript/
http://www.thecssninja.com/xhtml/futurebox
The problem with using :target as a CSS click event is that it has some downsides such as page jumps or browser history.
You can avoid the downsides of :target by using the checkbox hack:
Make a checkbox and hide it:
<input type="checkbox" id="check" style="display:none;">
Then, make the image you want to have a lightbox for, and wrap it in a <label>
<label for="check">
<img src="http://lorempixel.com/400/400/" width="200">
</label>
Now, write the HTML for the lightbox:
<label for="check">
<div id="cover">
<div id="box">
<img src="http://lorempixel.com/400/400/" width="400">
</div>
</div>
</label>
And now, for the CSS magic!
Create the lightbox css:
#cover{
position:absolute;
top:0;
bottom:0;
left:0;
right:0;
background:rgba(0,0,0,0.5);
display:none;
}
#box{
position:absolute;
top:0;
bottom:0;
left:0;
right:0;
margin:auto;
width:400px;
height:400px;
border:10px solid white;
}
This creates and centers the lightbox.
Now you need to add the click event:
#check:checked ~ label #cover{
display:block;
}
This CSS means, If #check is checked (:checked selector), find the sibling (~) with a id of #cover inside a label element and apply the rule to it.
That's it!
Your coding should look like this:
<input type="checkbox" id="check" style="display:none;">
<label for="check">
<img src="http://lorempixel.com/400/400/" width="200">
</label>
<label for="check">
<div id="cover">
<div id="box">
<img src="http://lorempixel.com/400/400/" width="400">
</div>
</div>
</label>
And CSS:
#check:checked ~ label #cover{
display:block;
}
#cover{
position:absolute;
top:0;
bottom:0;
left:0;
right:0;
background:rgba(0,0,0,0.5);
display:none;
}
#box{
position:absolute;
top:0;
bottom:0;
left:0;
right:0;
margin:auto;
width:400px;
height:400px;
border:10px solid white;
}
SEE THIS JSFIDDLE
I think what you're going for is definitely javascript or Jquery. here is a JSFiddle which shows what i'm on about.
HTML:
<img src="http://0.s3.envato.com/files/19320511/Scenery%2080x80%20Avatar.png"/>
<div id="divLargerImage"></div>
<div id="divOverlay"></div>
JQuery:
$('a img').click(function () {
var $img = $(this);
$('#divLargerImage').html($img.clone().height(250).width(250)).add($('#divOverlay')).fadeIn();
});
$('#divLargerImage').add($('#divOverlay')).click(function () {
$('#divLargerImage').add($('#divOverlay')).fadeOut(function () {
$('#divLargerImage').empty();
});
});
CSS:
#divLargerImage
{
display: none;
width: 250px;
height: 250px;
position: absolute;
top: 35%;
left: 35%;
z-index: 99;
}
#divOverlay
{
display: none;
position: absolute;
top: 0;
left: 0;
background-color: #CCC;
opacity: 0.5;
width: 100%;
height: 100%;
z-index: 98;
}
There are many ways to do this, but most easy way to do this is you can use lighbox tools like: FancyBox, Colorbox plugins etc.
Fancy Box: http://fancybox.net
Color Box: http://www.jacklmoore.com/colorbox/
Alternatively you can use: jQuery Lightbox Generator
jQuery Lightbox Generator: http://visuallightbox.com/
For the problem with pseudo-classes, what i got from your question is you want to enlarge image?
Check this Jsfiddle:
` http://jsfiddle.net/23zgvg1f/1/ `
I hope this helps :)
I have been working with several solutions on the web and have not found anything that works.
I am trying to do something that should be simple. I am trying to have an image of a "button" underneath an actual button. When I do this, the image always overlaps the button itself.
HTML:
<div id="button"> <!-- Container for my image and button -->
<img src="C:\Users\Hansen\Desktop\Websigte\Images\buttonUnclicked.png" />
<input type="button" value="Roofing" onclick="createImageRoof();" style="position: absolute"/>
</div>
CSS:
#button {
height:30px;
padding:3px;
position:relative;
}
input[type=button] {
font: 12px verdana,arial,sans-serif;
width: 86px;
float:left;
z-index:0;
}
Instead of using an actual image (which you won't be able to put behind anything), just make it a background image.
CSS:
#button {
height:30px;
padding:3px;
position:relative;
background: url('file:///C:/Users/Hansen/Desktop/Websigte/Images/buttonUnclicked.png');
background-repeat: no-repeat;
}
input[type=button] {
font: 12px verdana,arial,sans-serif;
width: 86px;
float:left;
z-index:0;
}
jsBin demo
Use a background image for #button if you want
<div id="button">
<input type="button" value="Roofing"/>
</div>
CSS:
#button {
width:90px;
height:30px;
padding:3px;
position:relative;
background: url(Images\buttonUnclicked.png);
}
#button > input {
position:absolute;
left:5px;
top:6px;
width: 86px;
}
If you adjust the number for the left and the top in the CSS, you can move your picture around. I called the picture #myImage in the HTML. Hope that helps.
CSS
#myImage{
position:absolute;
left:10px;
top:50px;
}
#button {
height:30px;
padding:3px;
position:relative;
}
input[type=button] {
font: 12px verdana,arial,sans-serif;
width: 86px;
float:left;
z-index:0;
}
html
<div id="button"> <!-- Container for my image and button -->
<img id="myImage" src="C:\Users\Hansen\Desktop\Websigte\Images\buttonUnclicked.png" />
<input type="button" value="Roofing" onclick="createImageRoof();" style="position: absolute"/>
</div>
I want to set that in put textbox's location on initial condition header div. But that textbox is getting hidden under initial condition div.
Are there any alternative to z-index. I have attached my css also.
HTML:
<div id="initialCondHdr" class="initialCondHdr">Demo Experiment</div>
<div id="archiveTable_filter" class="dataTables_filter">
<label>
<input type="text" placeholder="Search" style="width:220px;height:30px;" />
</label>
</div>
CSS:
#initialCondHdr {
color:#043751;
font-family:calibri;
font-size:19px;
line-height:42px;
position:relative;
text-indent:15px;
}
.dataTables_filter {
float: left;
left: 119px;
margin: 12px 0 22px 12px;
overflow: hidden;
position: absolute;
text-align: right;
top: -20px;
z-index: 5;
}
It's not entirely clear to me what you are trying to do but I think you are trying to lay the input on top of the first div.
That being the case, you will have to change the HTML structure and adjust the positioning of your input as follows:
JSfiddle Demo
Revised HTML
<div id="initialCondHdr" class="initialCondHdr">Demo Experiment
<div id="archiveTable_filter" class="dataTables_filter">
<label>
<input type="text" placeholder="Search" style="width:220px;height:30px;"/>
</label>
</div>
</div>
Revised CSS
#initialCondHdr{
color:#043751;
font-family:calibri;
font-size:19px;
line-height:42px;
position:relative;
text-indent:15px;
color:red; /* visual reference only */
}
.dataTables_filter{
overflow: hidden;
position: absolute;
opacity:0.5; /* visual reference only */
top:0;
text-align: right;
z-index: 1;
}