I have an issue with Dropzone.js. I would like to insert a background image, on top of which people can drag and drop their own image. The funny thing is that I can set the background of the dropzone to any color I want (I tried blue) and it works, however it doesn't work for an image...
You can see in the following CSS code extract:
/* *****CHAMP DROPZONE***** */
.dropzone {
border: 1px solid #256EB8;
/*min-height: 360px;*/
height:70px;
width:70px;
-webkit-border-radius: 3px;
border-radius: 3px;
/*background: blue;*/
background-image: url("MY_IMAGE.png");
padding: 0px;
margin:0px;
}
Any idea of what is going wrong?
If needed, here is more of the code below :
/* The MIT License */
.dropzone,
.dropzone *,
.dropzone-previews,
.dropzone-previews * {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
width:50%;
}
.dropzone {
position: relative;
/* border: 1px solid rgba(0,0,0,0.08);
background: rgba(0,0,0,0.02);
padding: 1em;*/
background-image: url("MY_IMAGE.png");
}
.dropzone .dz-message {
opacity: 1;
-ms-filter: none;
filter: none;
}
.dropzone.dz-drag-hover {
border-color: rgba(0,0,0,0.15);
background: rgba(0,0,0,0.04);
}
/* *****CHAMP CADRE BLANC***** */
.dropzone .dz-preview,
.dropzone-previews .dz-preview {
background: rgba(255,255,255,0.8);
position: relative;
display: inline-block;
margin: 0px;
vertical-align: top;
border: none;
padding: 0px 0px 0px 0px;
background-image: url("MY_IMAGE.png");
}
.dropzone .dz-preview.dz-file-preview [data-dz-thumbnail],
.dropzone-previews .dz-preview.dz-file-preview [data-dz-thumbnail] {
display: none;
}
/* *****CHAMP CADRE BLANC***** */
.dropzone .dz-preview .dz-details,
.dropzone-previews .dz-preview .dz-details {
width: 70px; /*******/
height: 70px; /*******/
position: relative;
background-image: url("MY_IMAGE.png");
/*background: #ebebeb;********************************/
padding: 0px;
margin-bottom: 0px;
}
.dropzone .dz-preview .dz-details .dz-filename,
.dropzone-previews .dz-preview .dz-details .dz-filename {
overflow: hidden;
height: 100%;
}
/* *****CHAMP IMAGE UPLOADEE***** */
.dropzone .dz-preview .dz-details img,
.dropzone-previews .dz-preview .dz-details img {
position: absolute;
top: 0;
left: 0;
width: 70px; /*******/
height: 70px; /*******/
-webkit-border-radius: 3px;
border-radius: 3px;
}
/* *****CHAMP DROPZONE***** */
.dropzone {
border: 1px solid #256EB8;
/*min-height: 360px;*/
height:70px;
width:70px;
-webkit-border-radius: 3px;
border-radius: 3px;
/*background: blue;*/
background-image: url("MY_IMAGE.png");
padding: 0px;
margin:0px;
}
/* *****CHAMP DROPZONE MESSAGE ACCUEIL***** */
.dropzone .dz-default.dz-message {
opacity: 1;
-ms-filter: none;
filter: none;
-webkit-transition: opacity 0.3s ease-in-out;
-moz-transition: opacity 0.3s ease-in-out;
-o-transition: opacity 0.3s ease-in-out;
-ms-transition: opacity 0.3s ease-in-out;
transition: opacity 0.3s ease-in-out;
/*background-image: url("../images/spritemap.png");*/
/*background-image: none;*/
background-image: url("MY_IMAGE.png");
/*background-repeat: no-repeat;
background-position: 0 0;*/
position: absolute;
width: 70px; /*******/
height: 70px; /*******/
/*margin-left: -214px;
margin-top: -61.5px;
top: 50%;
left: 50%;*/
}
#media all and (-webkit-min-device-pixel-ratio:1.5),(min--moz-device-pixel-ratio:1.5),(-o-min-device-pixel-ratio:1.5/1),(min-device-pixel-ratio:1.5),(min-resolution:138dpi),(min-resolution:1.5dppx) {
.dropzone .dz-default.dz-message {
background-image: url("MY_IMAGE.png");
-webkit-background-size: 428px 406px;
-moz-background-size: 428px 406px;
background-size: 428px 406px;
}
}
.dropzone .dz-default.dz-message span {
display: none;
}
/*
.dropzone.dz-square .dz-default.dz-message {
background-position: 0 -123px;
width: 268px;
margin-left: -134px;
height: 174px;
margin-top: -87px;
}
.dropzone.dz-drag-hover .dz-message {
opacity: 0.15;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=15)";
filter: alpha(opacity=15);
}
.dropzone.dz-started .dz-message {
display: block;
opacity: 0;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
}*/
/*.dropzone .dz-preview,
.dropzone-previews .dz-preview {
-webkit-box-shadow: 1px 1px 4px rgba(0,0,0,0.16);
box-shadow: 1px 1px 4px rgba(0,0,0,0.16);
font-size: 14px;
}*/
Thank you for your help!
Paul
The easiest solution I think is to add to your custom css file following code
.dropzone .dz-preview.dz-image-preview {
background-color: transparent !important;
}
This will help especially when you have dropzone's css file linked via cdn.
GOT IT!
The image was not located in a folder relative to the CSS file.
I changed the background image url the following way :
/* *****CHAMP DROPZONE***** */
.dropzone {
border: 1px solid #256EB8;
/*min-height: 360px;*/
height:70px;
width:70px;
-webkit-border-radius: 3px;
border-radius: 3px;
/*background: blue;*/
background-image: url("../images/MY_IMAGE.png");
padding: 0px;
margin:0px;
}
Related
I'm trying to give the look of a gradient border to a button by creating a span inside the button and setting some padding difference between them.
It works pretty well on codepen, but when I pass it to my website, something happens and these tags suddenly stop being aligned.
However, which is the best way to set a span centralized inside a button in order to simulate a border?
body{
background:white;
text-align:center;
box-sizing:border-box;
font-family:"Lato",Sans-serif;
padding-top:5%;
/* position:relative; */
}
.btn:link,
.btn:visited{
text-decoration: none;
text-transform:uppercase;
position:relative;
top:0;
left:0;
padding:22px 2px;
border-radius:100px;
display:inline-block;
transition: all .5s;
}
.btn-white{
background-image:linear-gradient(56deg, #08AEEA 0%, #2AF598 100%);
color:#000;
font-family: Lato;
font-size:1.3rem;
}
.btn span {
align-items: center;
background-color: #fff;
border-radius:100px;
display: absolute;
justify-content: center;
padding:20px 40px;
height: 100%;
transition: background .5s ease;
width: 100%;
}
.btn:hover span {
background: transparent;
}
.btn:hover{
background-image: linear-gradient(56deg, #08AEEA 0%, #2AF598 100%);
border: none;
box-shadow:0px 10px 10px rgba(0,0,0,0.2);
color: #fff;
transform : translateY(-3px);
}
.btn:active{
box-shadow:0px 5px 10px rgba(0,0,0,0.2)
transform:translateY(-1px);
}
.btn-bottom-animation-1{
animation:comeFromBottom 1s ease-out .8s;
}
.btn::after{
content:"";
text-decoration: none;
text-transform:uppercase;
position:absolute;
width:100%;
height:100%;
top:0;
left:0;
border-radius:100px;
display:inline-block;
z-index:-1;
transition: all .5s;
}
.btn-white::after {
background-image: linear-gradient(56deg, #08AEEA 0%, #2AF598 100%);
background-color: #fff;
}
.btn-animation-1:hover::after {
transform: scaleX(1.4) scaleY(1.6);
opacity: 0;
}
#keyframes comeFromBottom{
0%{
opacity:0;
transform:translateY(40px);
}
100%{
opacity:1;
transform:translateY(0);
}
}
<a class="btn" href="#">
<span>A brand new button!</span>
</a>
Well if it worked in Codepen and now doesn't its because your site is overriding something or you're not including the reset/normalize or vendor prefixing that Codepen is using by default.
Now you shouldn't need to do any "centering" to accomplish what I think you want.
Simply make the span a block level element and give it a margin or give the button padding.
button {
background-color: blue;
border: 2px solid darkBlue;
font-size: 14px;
padding: 4px;
}
button span {
display:block;
background: tan;
border:2px solid aqua;
padding: 10px 20px;
color: white;
}
<button>
<span>Text</span>
</button>
May be this is the solution that you intended to achieve. I have to edit a lot to your code to achieve that. Here is Codepen version
body {
background: white;
text-align: center;
box-sizing: border-box;
font-family: "Lato", Sans-serif;
padding-top: 5%;
/* position:relative; */
}
.btn:link,
.btn:visited {
text-decoration: none;
text-transform: uppercase;
/* position: relative; */
/* top: 0; */
/* left: 0; */
padding: 10px;
/* this padding will be your gradient border */
border-radius: 100px;
display: inline-block;
transition: all .5s;
border: none;
}
.btn:hover {
background-image: linear-gradient(56deg, #08AEEA 0%, #2AF598 100%);
/* border: none; */
box-shadow: 0px 10px 10px rgba(0, 0, 0, 0.2);
/* color: #fff; */
transform: translateY(-3px);
}
.btn span {
/* align-items: center; */
background-color: transparent;
/* background-color: #fff; */
border-radius: 100px;
/* display: absolute; */
/* justify-content: center; */
/* padding: 20px 40px; */
/* padding: 20px; */
/* height: 100%; */
/* transition: background .5s ease; */
transition: all .5s ease;
/* width: 100%; */
display: block;
padding: 20px 40px;
}
.btn:hover span {
/* background: transparent; */
background: #fff;
color: #ccc;
}
/* .btn-white {
background-image: linear-gradient(56deg, #08AEEA 0%, #2AF598 100%);
color: #000;
font-family: Lato;
font-size: 1.3rem;
} */
/*
.btn:active {
box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.2);
transform: translateY(-1px);
}
.btn-bottom-animation-1 {
animation: comeFromBottom 1s ease-out .8s;
} */
/* .btn::after {
content: "";
text-decoration: none;
text-transform: uppercase;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
border-radius: 100px;
display: inline-block;
z-index: -1;
transition: all .5s;
} */
/*
.btn-white::after {
background-image: linear-gradient(56deg, #08AEEA 0%, #2AF598 100%);
background-color: #fff;
}
.btn-animation-1:hover::after {
transform: scaleX(1.4) scaleY(1.6);
opacity: 0;
}
#keyframes comeFromBottom {
0% {
opacity: 0;
transform: translateY(40px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
*/
<a class="btn" href="#">
<span>A brand new button!</span>
</a>
I want to change the image on the button to this white version of it:http://res.cloudinary.com/djxai1v1e/image/upload/v1498062883/HR-Connect-Logowhite_fb7duw.png when hovered on. I thought I would just add a background-image to the :hover but that didn't work. Does anyone know how I can accomplish this? Anything helps, Cheers!
.button_slidehr {
color: #156466;
border: 1px solid rgba(21,100,102,0.35);
border-radius: 0px;
/* extend left padding */
padding: 18px 15px 18px 62px;
position: relative;
display: inline-block;
font-family: Verdana;
font-size: 14px;
margin-bottom: 20px;
letter-spacing: 1px;
background-color: rgba(255,255,255,0.3);
cursor: pointer;
box-shadow: inset 0 0 0 0 #156466;
-webkit-transition: ease-out 0.4s;
-moz-transition: ease-out 0.4s;
transition: ease-out 0.4s;
}
.slide_downhr:hover {
color:white;
border: 1px solid transparent;
box-shadow: inset 0 100px 0 0 #156466;
}
.button_slidehr:after {
content: "";
display: inline-block;
position: absolute;
left: 10px;
top: 0;
width: 100%;
height: 100%;
background-image: url(http://res.cloudinary.com/djxai1v1e/image/upload/v1498058230/HR-Connect-Logo_hjbrmn.png);
background-position: left center;
background-repeat: no-repeat;
background-size: auto 80%;
}
<div class="button_slidehr slide_downhr">Contact HR Now></div>
.button_slidehr {
color: #156466;
border: 1px solid rgba(21,100,102,0.35);
border-radius: 0px;
/* extend left padding */
padding: 18px 15px 18px 62px;
position: relative;
display: inline-block;
font-family: Verdana;
font-size: 14px;
margin-bottom: 20px;
letter-spacing: 1px;
background-color: rgba(255,255,255,0.3);
cursor: pointer;
box-shadow: inset 0 0 0 0 #156466;
-webkit-transition: ease-out 0.4s;
-moz-transition: ease-out 0.4s;
transition: ease-out 0.4s;
}
.slide_downhr:hover {
color:white;
border: 1px solid transparent;
box-shadow: inset 0 100px 0 0 #156466;
}
.button_slidehr:hover:after {
background-image: url(http://res.cloudinary.com/djxai1v1e/image/upload/v1498062883/HR-Connect-Logowhite_fb7duw.png);
}
.button_slidehr:after {
content: "";
display: inline-block;
position: absolute;
left: 10px;
top: 0;
width: 100%;
height: 100%;
background-image: url(http://res.cloudinary.com/djxai1v1e/image/upload/v1498058230/HR-Connect-Logo_hjbrmn.png);
background-position: left center;
background-repeat: no-repeat;
background-size: auto 80%;
}
<div class="button_slidehr slide_downhr">Contact HR Now></div>
.slide_downhr:hover:after {
background-image: url(http://res.cloudinary.com/djxai1v1e/image/upload/v1498062883/HR-Connect-Logowhite_fb7duw.png);
}
I'm looking for a solution for this:
When the image starting the transition it loses the reflection till the end, when it comes back.
What am I missing? Thanks!
.specials-box {
width: 330px;
margin: 50px 0;
height: 500px;
position: relative;
cursor: pointer;
}
.special-img {
width: 80%;
position: absolute;
top: 20px;
left: 10%;
transition: all 0.3s ease-in-out;
-webkit-box-reflect: below 0px -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(70%, transparent) , to(rgba(250, 250, 250, 0.3)));
transition: all 0.3s ease-in-out;
filter: grayscale(100%);
}
.specials-box:hover .special-img {
filter: grayscale(0%);
top:0;
transition: all 0.3s ease-in-out;
-webkit-box-reflect: below 25px -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(70%, transparent) , to(rgba(250, 250, 250, 0.3)));
}
<div class="specials-box">
<img class="special-img" src="https://koktelbolt.shoprenter.hu/custom/koktelbolt/image/data/specials/4.png" />
</div>
Gradients don't support transitions yet (although the current spec says they should support like gradient to like gradient transitions via interpolation.).
just posted an example for understanding
.year {
display: inline-block;
padding: 10px 15px;
cursor: pointer;
text-align: center;
color: #fff;
font-size: 17px;
border-radius: 20px;
background: rgba(5,176,196,1);
background: -webkit-linear-gradient(170deg, #05b0c4, #80ff8f);
background: -o-linear-gradient(170deg, 170deg, #05b0c4, #80ff8f);
background: -moz-linear-gradient(170deg, 170deg, #05b0c4, #80ff8f);
background: linear-gradient(170deg, #05b0c4, #80ff8f);
transition:all 0.4s linear;
}
.year:hover {
background: rgba(5,176,196,1);
background: -webkit-linear-gradient(170deg, #80ff8f, #05b0c4);
background: -o-linear-gradient(170deg, #80ff8f, #05b0c4);
background: -moz-linear-gradient(170deg, #80ff8f, #05b0c4);
background: linear-gradient(170deg, #80ff8f, #05b0c4);
}
<div class="year">2017</div>
You can use pseudo classes for it
.button {
display: inline-block;
margin-top: 10%;
padding: 1em 2em;
font-size: 2em;
color: #fff;
font-family: arial, sans-serif;
text-decoration: none;
border-radius: 0.3em;
position: relative;
background-color: #ccc;
background-image: linear-gradient(to top, #6d8aa0, #8ba2b4);
-webkit-backface-visibility: hidden;
z-index: 1;
}
.button:after {
position: absolute;
content: '';
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 0.3em;
background-image: linear-gradient(to top, red, blue);
transition: opacity 0.5s ease-out;
z-index: 2;
opacity: 0;
}
.button:hover:after {
opacity: 1;
}
.button span {
position: relative;
z-index: 3;
}
body {
text-align: center;
background: #ddd;
}
<a class="button" href="#"><span>BUTTON</span></a>
I have an image banner which I'm trying to add a button on top of it. The button is in HTML format and not an image. However, the problem is that I'm unable to move the button on top of the image. I believe it has to do with the margin of the button. I've implemented the following codes into my Weebly website, and though the button seems to fit perfectly well inside the editor, after publishing, the button displays on the bottom of the banner. Here is my HTML code:
The "margin:-70px" seems to be correct, though it doesn't apply after publishing. So what's wrong? Is there something missing?
.btn_action_1 {
border: 5px solid #000 !important;
/* Change button border color */
color: #000 !important;
/* Change button text color */
font-size: 22px;
font-family: 'Ubuntu';
line-height: 0;
display: inline-block;
padding: 10px 15px 10px;
position: relative;
text-decoration: none;
z-index: 3;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.btn_action_1 span {
left: 10px;
position: relative;
-o-transition: all .4s;
-moz-transition: all .4s;
-webkit-transition: all .4s;
transition: all .4s;
}
.btn_action_1 .ico_arrow {
background: url(ico_arrow_w.png) 0 center no-repeat;
display: inline-block;
height: 17px;
width: 17px;
position: relative;
left: -12px;
top: 0px;
opacity: 0;
filter: alpha(opacity=0);
-o-transition: all .4s;
-moz-transition: all .4s;
-webkit-transition: all .4s;
transition: all .4s;
}
.btn_action_1:hover {
background: #000 !important;
/* Change button background color when mouse over */
color: #fff !important;
/* Change button text color when mouse over */
}
.btn_action_1:hover span {
left: -5px;
}
.btn_action_1:hover .ico_arrow {
opacity: 1;
filter: alpha(opacity=100);
left: 5px;
}
#media (max-width: 479px) {
.btn_action_1 {
padding: 18px 30px;
}
}
.btn_action_1:not(:hover)>.hover,
.btn_action_1:hover>.default {
display: none
}
<img src="http://unlckpaypal.weebly.com/uploads/6/3/8/8/63884033/left_banner.png" style="margin: 10px 0px 0px 0px;width:440px;height:210px;">
<a href="http://unlckpaypal.weebly.com/trending-127809.html" style="margin:-70px 0px 0px 200px;width:180px;height:45px;" class="btn_action_1">
<span>SHOP NOW</span>
<i class="ico_arrow"></i>
</a>
Give this code to padding: 10px 15px 10px; to .btn_action_1 span this class, I think it will work
.btn_action_1 {
border: 5px solid #000 !important; /* Change button border color */
color: #000 !important; /* Change button text color */
font-size: 22px;
font-family: 'Ubuntu';
line-height: 0;
display: inline-block;
padding: 10px 15px 10px;
position: relative;
text-decoration: none;
z-index: 3;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.btn_action_1 span {
left: 10px;
position: relative;
-o-transition: all .4s;
-moz-transition: all .4s;
-webkit-transition: all .4s;
transition: all .4s;
}
.btn_action_1 .ico_arrow {
background: url(ico_arrow_w.png) 0 center no-repeat;
display: inline-block;
height: 17px;
width: 17px;
position: relative;
left: -12px;
top: 0px;
opacity: 0;
filter: alpha(opacity=0);
-o-transition: all .4s;
-moz-transition: all .4s;
-webkit-transition: all .4s;
transition: all .4s;
}
.btn_action_1:hover {
background: #000 !important; /* Change button background color when mouse over */
color: #fff !important; /* Change button text color when mouse over */
}
.btn_action_1:hover span {
left: -5px;
}
.btn_action_1:hover .ico_arrow {
opacity: 1;
filter: alpha(opacity=100);
left: 5px;
}
#media (max-width: 479px) {
.btn_action_1 {
padding: 18px 30px;
}
}
.btn_action_1:not(:hover)>.hover,
.btn_action_1:hover>
.default {display:none}
<img src="http://unlckpaypal.weebly.com/uploads/6/3/8/8/63884033/left_banner.png"
style="margin: 10px 0px -50px 0px;width:440px;height:210px; position:relative;">
<a href="http://unlckpaypal.weebly.com/trending-127809.html"
style="margin:-30px 10px 10px 220px;width:180px;height:45px; "
class="btn_action_1">
<span>SHOP NOW</span>
<i class="ico_arrow"></i>
</a>
Just add this class
.img-wrapper .btn_action_1{
display:block;
margin-top:-100px
}
Fiddler https://jsfiddle.net/ov9rxuys/
i recommend using absolute position for the button since there is no alternative
.btn_action_1 {
position: absolute; /* remove margin from HTML if possible */
bottom: 20px; /* adjust as you want it to be */
right: 50px; /* adjust as you want it to be */
}
i have jsfiddle for it https://jsfiddle.net/Ls6coLb7/
I have a problem in chrome. I set a before statement to my class .button to make an animation on hover, but the end of the ::before is crop :
http://i.stack.imgur.com/s558b.gif
And the code source :
body {
background:#000;
}
.button {
display: inline-block;
position: relative;
cursor: pointer;
padding: 12px 24px 14px 24px;
box-shadow:inset 0 0 0 2px #0282d1;
border-radius: 999px;
overflow: hidden;
z-index: 10;
}
button {
border:0;
background:none;
color:#fff;
}
button::before {
content: '';
z-index: -1;
position: absolute;
top: 50%;
right: 100%;
margin: -15px 0 0 1px;
width: 30px;
height: 30px;
background: linear-gradient(to right, #02AFF1, #0057A3);
transform-origin: 0 50%;
transform: scale3d(1, 2, 1);
transition: transform 300ms ease-in, opacity 300ms ease-in;
border-radius: 999px;
vertical-align: middle;
}
.button:hover::before {
transform: scale3d(9, 9, 1);
}
<button class="button">ACCUEIL</button>
I can't find solution on google.
It's works on safari & firefox.
Thanks.