How to properly centralize span inside a button? - html

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>

Related

Nav bar to the side going down content to right; does not go to the right side it goes under the nav bar in the left side

the menu class name is in the navBar compoent
and the center info is in one of the tab that open it in the code here is a link to my github.
https://github.com/aalsaedi265/CyberWebpage
The goal to have the nar bar be on the left side and when I click a tab, the content will appear on the right side.
right know it appears on the nav bar
:root{
--red-scanline: rgba(204,94,98,0.2);
--black-scanline: rgba(1,1,1,0.9);
--yellow: #f7f500;
--red-glow: rgba(211,87,91, 0.91);
--blue: #61e4fa;
}
*{
box-sizing: border-box;
}
html,body{
margin: 0;
height: 100%;
display: block;
}
body{
background-image: url("./pictureFile/Day.png");
/* color: white; */
background-size: cover;
}
.menu {
margin-left: 150px;
width: 400px;
height: 100%;
display: inline-block;
/* this is was i used to get the background for the meue */
background: repeating-linear-gradient(
to bottom,
transparent 0%,
var(--red-scanline)1px,
var(--red-scanline)4px,
var(--red-scanline)5px,
transparent 0.5%
),
repeating-linear-gradient(
to left,
var(--black-scanline),
var(--black-scanline) 100%
);
}
.logo{
color:#f7f500;
font-family:'Cyberpunk';
font-size:42px;
line-height: 1.5;
text-align: center;
text-shadow: rgb(0,208,255) 2px 3px 0px;
padding:25px;
}
.sublogo{
font-family:Cyberpunk;
font-size:26px;
color: rgb(0,208,255);
text-shadow: none;
text-align:right;
letter-spacing:17px;
/* a lttle left so not so stuck */
padding-right:15px;
}
.menu li{
list-style-type: none;
padding: 0px 25px;
}
.Center_page_info{ //this is the content compenent css
display: grid;
grid-template-columns: repeat(2, 1fr);
overflow: none;
gap: 1.5rem;
width: 100%;
margin-bottom: 5rem;
width:800px;
margin: 0 auto;
}
.the_list{ //this is the nav bar css
float:left;
}
.menu ul li{
text-transform: uppercase;
cursor:pointer;
/* font related*/
color:rgba(211,87,91,0.81);
font-family:Cyberpunk;
letter-spacing:4.0px;
font-size:23px;
text-shadow: 0px 0px 3px var(--red-glow);
/*border*/
border-style: solid;
border-width: 2px;
border-color: var(--blue);
border-color: transparent;
/*layout*/
position: relative;
padding: 10px;
margin:15px 0px;
width: 350px;
height:54.5px;
clip-path: polygon(350px 0px, 350px 29px, 322px 57px, 0px 57px, 0px 0px);
/* Animation */
transition: color 1s ease-out;
transition: border-color 1s ease-out
}
.menu ul li:hover::after,
.menu ul li:hover{
color:var(--blue);
border-color: var(--blue);
/*transition*/
transition:color 0.23s linear;
transition:border-color 0.23s linear;
}
.menu ul li::after{
content: "";
width:30px;
height: 30px;
position:absolute;
transform:rotate(45deg);
bottom:-17px;
right: -17px;
/*border*/
border-width: 2px;
border-style:solid;
border-color: transparent;
/* Animation */
transition: color 1s ease-out;
transition: border-color 1s ease-out;
}

Content showing over the top of tooltip

I am setting a tooltip with content on my website. The content outside the tooltip is showing over one of my tooltip
Demo Link:
Code:
/*
You want a simple and fancy tooltip?
Just copy all [data-tooltip] blocks:
*/
[data-tooltip] {
position: relative;
z-index: 10;
}
/* Positioning and visibility settings of the tooltip */
[data-tooltip]:before,
[data-tooltip]:after {
position: absolute;
visibility: hidden;
opacity: 0;
left: 50%;
bottom: calc(100% + 5px);
/* 5px is the size of the arrow */
pointer-events: none;
transition: 0.2s;
will-change: transform;
}
/* The actual tooltip with a dynamic width */
[data-tooltip]:before {
content: attr(data-tooltip);
padding: 10px 18px;
min-width: 50px;
max-width: 300px;
width: max-content;
width: -moz-max-content;
border-radius: 6px;
font-size: 14px;
background-color: rgba(59, 72, 80, 0.9);
background-image: linear-gradient(30deg, rgba(59, 72, 80, 0.44), rgba(59, 68, 75, 0.44), rgba(60, 82, 88, 0.44));
box-shadow: 0px 0px 24px rgba(0, 0, 0, 0.2);
color: #fff;
text-align: center;
white-space: pre-wrap;
transform: translate(-50%, -5px) scale(0.5);
}
/* Tooltip arrow */
[data-tooltip]:after {
content: '';
border-style: solid;
border-width: 5px 5px 0px 5px;
/* CSS triangle */
border-color: rgba(55, 64, 70, 0.9) transparent transparent transparent;
transition-duration: 0s;
/* If the mouse leaves the element,
the transition effects for the
tooltip arrow are "turned off" */
transform-origin: top;
/* Orientation setting for the
slide-down effect */
transform: translateX(-50%) scaleY(0);
}
/* Tooltip becomes visible at hover */
[data-tooltip]:hover:before,
[data-tooltip]:hover:after {
visibility: visible;
opacity: 1;
}
/* Scales from 0.5 to 1 -> grow effect */
[data-tooltip]:hover:before {
transition-delay: 0.3s;
transform: translate(-50%, -5px) scale(1);
}
/*
Arrow slide down effect only on mouseenter (NOT on mouseleave)
*/
[data-tooltip]:hover:after {
transition-delay: 0.5s;
/* Starting after the grow effect */
transition-duration: 0.2s;
transform: translateX(-50%) scaleY(1);
}
/*
That's it.
*/
/*
If you want some adjustability
here are some orientation settings you can use:
*/
/* LEFT */
/* Tooltip + arrow */
[data-tooltip-location="left"]:before,
[data-tooltip-location="left"]:after {
left: auto;
right: calc(100% + 5px);
bottom: 50%;
}
/* Tooltip */
[data-tooltip-location="left"]:before {
transform: translate(-5px, 50%) scale(0.5);
}
[data-tooltip-location="left"]:hover:before {
transform: translate(-5px, 50%) scale(1);
}
/* Arrow */
/* BOTTOM */
[data-tooltip-location="bottom"]:before,
[data-tooltip-location="bottom"]:after {
top: calc(100% + 5px);
bottom: auto;
}
[data-tooltip-location="bottom"]:before {
transform: translate(-50%, 5px) scale(0.5);
}
[data-tooltip-location="bottom"]:hover:before {
transform: translate(-50%, 5px) scale(1);
}
[data-tooltip-location="bottom"]:after {
border-width: 0px 5px 5px 5px;
border-color: transparent transparent rgba(55, 64, 70, 0.9) transparent;
transform-origin: bottom;
}
/* Settings that make the pen look nicer */
html {
width: 100%;
height: 100%;
font-family: 'Roboto', sans-serif;
color: white;
font-size: 1.2em;
background: linear-gradient(45deg, #243949, #2cacd1, #35eb93);
background-size: 120% 120%;
animation: moveFocus 5s ease infinite alternate;
}
#keyframes moveFocus {
0% {
background-position: 0% 100%
}
100% {
background-position: 100% 0%
}
}
body {
background: none;
display: flex;
flex-direction: column;
height: 100%;
margin: 0;
}
main {
padding: 0 4%;
display: flex;
flex-direction: row;
margin: auto 0;
}
button {
margin: 0;
padding: 0.7rem 1.4rem;
cursor: pointer;
text-align: center;
border: none;
border-radius: 4px;
outline: inherit;
text-decoration: none;
font-family: Roboto, sans-serif;
font-size: 0.7em;
background-color: rgba(174, 184, 192, 0.55);
color: white;
-webkit-appearance: none;
-moz-appearance: none;
transition: background 350ms ease-in-out, transform 150ms ease;
}
button:hover {
background-color: #484f56;
}
button:active {
transform: scale(0.98);
}
button:focus {
box-shadow: 0 0 2px 2px #298bcf;
}
button::-moz-focus-inner {
border: 0;
}
.example-elements {
flex-grow: 1;
display: flex;
flex-direction: column;
align-items: center;
align-content: center;
justify-content: center;
text-align: center;
padding-right: 4%;
}
.example-elements p {
padding: 6px;
display: inline-block;
margin-bottom: 5%;
color: #fff;
}
.example-elements p:hover {
border-left: 1px solid lightgrey;
border-right: 1px solid lightgrey;
padding-left: 5px;
padding-right: 5px;
}
.example-elements a {
margin-left: 6px;
margin-bottom: calc(5% + 10px);
color: #76daff;
text-decoration: none;
}
.example-elements a:hover {
margin-bottom: calc(5% + 9px);
border-bottom: 1px solid #76daff;
}
.example-elements button {
margin-bottom: 20px;
}
.info-wrapper {
flex-grow: 8;
display: flex;
flex-direction: column;
justify-content: center;
text-align: justify;
padding-left: 6%;
border-left: 3px solid #35ea95;
}
.info-wrapper p {
color: rgba(255, 255, 255, 0.69);
}
.info-wrapper p {
max-width: 600px;
text-align: justify;
}
.info-wrapper .title-question {
display: block;
color: #fff;
font-size: 1.36em;
font-weight: 500;
padding-bottom: 24px;
}
#media (max-height: 450px) {
main {
margin: 2rem 0;
}
}
#media (max-width: 800px) {
html {
font-size: 0.9em;
}
}
/* Thumbnail settings */
#media (max-width: 750px) {
html {
animation-duration: 0.6s;
font-size: 1em;
}
body {
display: flex;
background: none;
height: 100%;
margin: 0px;
}
main {
font-size: 1.1em;
padding: 6%;
}
.info-wrapper p:before,
.info-wrapper p:after {
display: none;
}
.example-elements {
max-width: 150px;
font-size: 22px;
}
.example-elements a,
button {
display: none;
}
.example-elements p:before,
.example-elements p:after {
visibility: visible;
opacity: 1;
}
.example-elements p:before {
content: "Tooltip";
font-size: 20px;
transform: translate(-50%, -5px) scale(1);
}
.example-elements p:after {
transform: translate(-50%, -1px) scaleY(1);
}
[data-tooltip]:after {
bottom: calc(100% + 3px);
}
[data-tooltip]:after {
border-width: 7px 7px 0px 7px;
}
}
<main>
<div class="info-wrapper">
<p>
<span class="title-question">
You want a simple, animated & easy-to-use tooltip?
</span>
<span>
Just copy all the CSS declarations blocks starting with
<code>[data-tooltip].</code>
</span>
</p>
<p data-tooltip="This is an example of a super long tooltip text that goes over multiple lines.
Note: The tooltip size is dynamically adjusted to the content. However, a minimum and a maximum width are defined." data-tooltip-location="bottom">
To use the tooltip, simply add the attribute »data-tooltip« with the desired text to an element. P.S. Hover over me to see a long tooltip.
</p>
<p data-tooltip="This is an example of a super long tooltip text that goes over multiple lines.
Note: The tooltip size is dynamically adjusted to the content. However, a minimum and a maximum width are defined." data-tooltip-location="top">
To use the tooltip, simply add the attribute »data-tooltip« with the desired text to an element. P.S. Hover over me to see a long tooltip.
</p>
</div>
</main>
Remove z-index to [data-tooltip]
Add z-index to [data-tooltip]:before, [data-tooltip]:after
[data-tooltip] {
position: relative;
/*z-index:1; */ /* Remove this */
}
[data-tooltip]:before,
[data-tooltip]:after {
z-index:1;
}

CSS Inheritance not working correctly for tabs

I've fairly simple CSS code for my tabs. Problem is I'm adding this as part of larger CSS base and I keep getting it overwritten by defaults. For example I have a * { font-size: 8pt; } which forces itself into my new added CSS.
/*
#import url('https://fonts.googleapis.com/css?family=Roboto');
*/
/*
#import url('https://use.fontawesome.com/releases/v5.7.2/css/all.css');
*/
/*
body {
font-family: 'Roboto', sans-serif;
}
*/
.tabsWrapper {
text-align: center;
margin: 50px auto;
font-family: 'Roboto', sans-serif !important;
}
.tabs {
font-family: 'Roboto', sans-serif !important;
margin-top: 50px;
font-size: 15px;
padding: 0px;
list-style: none;
background: #fff;
box-shadow: 0px 5px 20px rgba(0, 0, 0, 0.1);
/*
display: inline-block;
*/
/*
border-radius: 50px;
*/
position: relative;
}
.tabs a {
text-decoration: none;
color: #777;
text-transform: uppercase;
padding: 10px 20px;
display: inline-block;
position: relative;
z-index: 1;
transition-duration: 0.6s;
}
.tabs a.active {
color: #fff;
}
.tabs a i {
margin-right: 5px;
}
.tabs .selector {
display: none;
height: 100%;
position: absolute;
left: 0px;
top: 0px;
right: 0px;
bottom: 0px;
z-index: 1;
/*
border-radius: 50px;
*/
transition-duration: 0.6s;
transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55);
background: #05abe0;
background: -moz-linear-gradient(45deg, #05abe0 0%, #8200f4 100%);
background: -webkit-linear-gradient(45deg, #05abe0 0%, #8200f4 100%);
background: linear-gradient(45deg, #05abe0 0%, #8200f4 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#05abe0', endColorstr='#8200f4', GradientType=1);
}
.tabs-content {
display: none;
}
.tabs-content.active {
display: block;
}```
/*
#import url('https://fonts.googleapis.com/css?family=Roboto');
*/
/*
#import url('https://use.fontawesome.com/releases/v5.7.2/css/all.css');
*/
/*
body {
font-family: 'Roboto', sans-serif;
}
*/
.tabsWrapper {
text-align: center;
margin: 50px auto;
font-family: 'Roboto', sans-serif !important;
}
.tabs {
font-family: 'Roboto', sans-serif !important;
margin-top: 50px;
font-size: 15px;
padding: 0px;
list-style: none;
background: #fff;
box-shadow: 0px 5px 20px rgba(0, 0, 0, 0.1);
/*
display: inline-block;
*/
/*
border-radius: 50px;
*/
position: relative;
}
.tabs a {
text-decoration: none;
color: #777;
text-transform: uppercase;
padding: 10px 20px;
display: inline-block;
position: relative;
z-index: 1;
transition-duration: 0.6s;
}
.tabs a.active {
color: #fff;
}
.tabs a i {
margin-right: 5px;
}
.tabs .selector {
display: none;
height: 100%;
position: absolute;
left: 0px;
top: 0px;
right: 0px;
bottom: 0px;
z-index: 1;
/*
border-radius: 50px;
*/
transition-duration: 0.6s;
transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55);
background: #05abe0;
background: -moz-linear-gradient(45deg, #05abe0 0%, #8200f4 100%);
background: -webkit-linear-gradient(45deg, #05abe0 0%, #8200f4 100%);
background: linear-gradient(45deg, #05abe0 0%, #8200f4 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#05abe0', endColorstr='#8200f4', GradientType=1);
}
.tabs-content {
display: none;
}
.tabs-content.active {
display: block;
}
<body>
<div class="tabsWrapper">
<div class="tabs">
<div class="selector"></div>
<a href="javascript:void(0)" class="active" data-id="Tab-40w1lgn2"><i class="fas fa-bomb">Test
</i>
</a>
<a href="javascript:void(0)" data-id="Tab-w2mo0zn9"><i class="fas fa-bomb">Test5
</i>
</a>
</div>
</div>
</body>
My understanding was that if I add !Important for tabs CSS it would make sure that everything down of tabs gets that setting including A/I and so on. But it doesn't work. It only works if I move font-size down to A/I element which is not what I want. I would like to make sure that settings go down properly to the elements below. What is the easiest way?
The universal selector will be applied to each and every element. Even when the font-size is set on .tabs, the * will set font-size again on the a and i children.
If you want to have proper inheritance, use
body {
font-size: 8pt;
}
This will keep the 8pt size until an element defines another size.
Some more information here
Could it be because your include: #import url('https://fonts.googleapis.com/css?family=Roboto'); is commented out?

-webkit-box-reflect disappears while transitioning

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>

Dropzone.js setting background pic

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;
}