I have an image with a background image, and hovering on it will scale and rotate with CSS 2D transforms. Everything works fine, except a white gap line of 1px, which looks terrible. This doesn't happen just in Chrome, but almost all browsers. I've tried the following, but without success:
adding -webkit-backface-visibility: hidden to the image div and/or
its wrapper
adding -webkit-transform: translateZ(0) scale(1.0, 1.0) to the image div and/or its wrapper
trying different display values
trying different position values
I think this problem only persists when using overflow: hidden.
HTML:
<a href="#" class="article col-xs-4">
<div class="article-overlay"></div>
<div class="article-content">
<h2>Learn the skills to land your dream job</h2>
<h6>Education / Academy</h6>
</div>
<div class="article-image" style="background-image: url('assets/images/ed1.jpg')"></div>
</a>
CSS:
#main-content .education .article {
display: block;
height: 100%;
position: relative;
z-index: 1;
padding: 0;
text-decoration: none;
overflow: hidden;
}
#main-content .education .article .article-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 2;
transition: all 0.5s;
background-color: rgba(0, 0, 0, 0.5);
}
#main-content .education .article:hover .article-overlay {
background-color: rgba(0, 0, 0, 0.35);
}
#main-content .education .article .article-image {
width: 100%;
height: 100%;
position: relative;
background-position: center;
-webkit-transform: scale(1) rotate(0deg);
transform: scale(1) rotate(0deg);
transition: all 0.5s;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
#main-content .education .article:hover .article-image {
-webkit-transform: scale(1.2) rotate(2deg);
transform: scale(1.2) rotate(2deg);
}
#main-content .education .article .article-content {
z-index: 3;
color: #fff;
position: relative;
text-align: center;
position: absolute;
width: 60%;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -100%);
transform: translate(-50%, -100%);
}
#main-content .education .article .article-content h2 {
text-transform: uppercase;
font-weight: 700;
font-size: 22px;
letter-spacing: 1px;
line-height: 40px;
position: relative;
padding-top: 20px;
margin: 0;
}
#main-content .education .article .article-content h2:before {
content: "";
display: block;
width: 150px;
height: 6px;
background-color: #bedb39;
position: absolute;
top: 0;
left: 50%;
margin-left: -75px;
}
#main-content .education .article .article-content h6 {
font-weight: normal;
text-transform: uppercase;
font-size: 16px;
position: relative;
padding-top: 20px;
margin: 0;
}
#main-content .education .article .article-content h6:before {
content: "";
display: block;
width: 150px;
height: 2px;
background-color: #fff;
position: absolute;
top: 0;
left: 50%;
margin-left: -75px;
}
Live demo:
http://amarsyla.com/sandbox/codo/education.html
ok, its becouse of z-index, clear z-index from #main-content .education .article and you can set z-index to .logo and .social-icons for example 20 for bringing to front.
#main-content .education .article {
display: block;
height: 100%;
position: relative;
padding: 0;
text-decoration: none;
overflow: hidden;
}
#header .logo, #header .social-icons {
z-index: 20;
}
Related
Im having a very annoying problem in Shopify. My banners were working fine but all of a sudden this class called "row" came up and is pushing my banner off to the side on both mobile and desktop. I cant get my banners to work correctly, I went through my entire code to see if I had any errors and I do not, I tried to look for a ".row" that could be messing up everything but its only gridlock .row and that is something I dont feel I should be messing with, as im not sure what it does. Anyhow, thank you for your time!
Any help is greatly appreciated!
Problem
What I see as the issue
CSS
.bannerheadercontainer {
width: 100vw;
position: relative;
top: 0px;
left: calc(-50vw + 50%);
display: table;
padding: 0px;
margin: 0px;
}
.bannercontainer {
position: relative;
width: 100%;
}
.bannercontainer .btnstyle {
font-weight: bold;
position: absolute;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-webkit-appearance: none;
color: white;
font-size: 15px;
font-size: 4vw;
border: none;
border-radius: 0px! important;
height: 16%;
text-align: center;
line-height: 0vw;
cursor: pointer;
}
.bannercontainer .imgstyle {
position: absolute;
}
.bannercontainer .btnstyle span {
cursor: pointer;
display: inline-block;
position: relative;
transition: 0.5s;
}
.bannercontainer .btnstyle span:after {
content: '\00bb';
position: absolute;
opacity: 0;
top: 0;
right: -20px;
transition: 0.5s;
}
.bannercontainer .btnstyle:hover span {
padding-right: 25px;
}
.bannercontainer .btnstyle:hover span:after {
opacity: 1;
right: 0;
}
.bannercontainer .btnstyleDesktop {
position: absolute;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-webkit-appearance: none;
color: white;
font-weight: bold;
font-size: 8px;
font-size: 1.5vw;
border: none;
border-radius: 0px! important;
height: 12%;
text-align: center;
line-height: 0vw;
cursor: pointer;
}
.bannercontainer .btnstyleDesktop span {
cursor: pointer;
display: inline-block;
position: relative;
transition: 0.5s;
}
.bannercontainer .btnstyleDesktop span:after {
content: '\00bb';
position: absolute;
opacity: 0;
top: 0;
right: -20px;
transition: 0.5s;
}
.bannercontainer .btnstyleDesktop:hover span {
padding-right: 25px;
}
.bannercontainer .btnstyleDesktop:hover span:after {
opacity: 1;
right: 0;
}
.bannerimg {
filter: brightness(30%);
}
/*------ CSS MOBILE ONLY -----*/
#media only screen and (max-width: 599px) {
.bannerheadercontainer {
top: -10px;
}
.pagetitle {
font-size: 18px !important;
}
.overlaybanner {
top: -1px;
height: 98%;
}
.index-banner {
height: 300px !important;
background-size: 200% 100%;
background-repeat: no-repeat;
}
.styc-container {
width: 100%;
}
.index-gray-section-style {
background-color: #F9F9F9;
min-height: 390px;
width: 100%;
}
.index-gray-section-connected {
background-color: #F9F9F9;
min-height: 390px;
width: 100%;
}
}
HTML CODE
<!----START BANNER----->
<div id="content-desktop">
<div class="bannerheadercontainer">
<img style="width: 100%;" class="bannerimg" src="https://cdn.shopify.com/s/files/1/0025/8719/7497/files/ecobanner-compressor_2048x2048.png?v=1529095445">
<div class="overlayheaderbanner"></div>
<div class="pagetitle">ECO-FRIENDLY</div>
</div>
</div>
<div id="content-mobile">
<div class="bannerheadercontainer">
<img style="width: 100%;" class="bannerimg" src="https://cdn.shopify.com/s/files/1/0025/8719/7497/files/eco-compressor_large.png?v=1529427950">
<div style="top: 0px; height: 97%;" class="overlayheaderbanner"></div>
<div class="pagetitle">ECO-FRIENDLY</div>
</div>
</div>
<!----END BANNER----->
Change width '100vw to 100%' in your code, it will work
.bannerheadercontainer { width: 100%;}
I'm trying to make my "Icon_POS_bitmap.png" responsive. If I view the Website on a laptop, the image is cut off at the bottom. I know i can't put the .hero-slides .single-hero-slides on a fixed 1000px height. But height: 100%; and height: auto; doesn't seem to work.
When I try to set things on auto or 100%, the image disappears and the following div "sonar-project-areas" goes at the top.
HTML
<section class="hero-area">
<div class="hero-slides">
<!-- Single Hero Slide -->
<div class="single-hero-slide bg-img slide-background-overlay" style="background-image: url(img/bg-img/Icon_POS_bitmap.png);">
</div>
</div>
</section>
CSS
.hero-slides .single-hero-slide {
height: 1000px;
width: 100%;
position: relative;
z-index: 1;
-webkit-transition-duration: 800ms;
transition-duration: 800ms;
overflow: visible;
/*cursor: pointer; */
}
.hero-slides .single-hero-slide .hero-slides-content {
position: relative;
z-index: 1;
-webkit-transform: translateY(75%);
transform: translateY(75%);
-webkit-transition-duration: 800ms;
transition-duration: 800ms;
bottom: 0;
}
.hero-slides .single-hero-slide .hero-slides-content .line {
width: 100px;
height: 1px;
background-color: #ffffff;
margin-bottom: 30px;
display: block;
}
.hero-slides .single-hero-slide .hero-slides-content h2 {
color: #ffffff;
font-weight: 100;
}
.hero-slides .single-hero-slide .hero-slides-content p {
color: #ffffff;
margin-bottom: 0;
-webkit-transition-duration: 500ms;
transition-duration: 500ms;
margin-top: 140px;
}
.hero-slides .single-hero-slide:hover .hero-slides-content {
-webkit-transform: translateY(0%);
transform: translateY(0%);
}
.hero-slides .single-hero-slide:hover p {
margin-top: 40px;
}
.bg-img {
background-position: center center;
background-size: cover;
background-repeat: no-repeat;
}
.slide-background-overlay {
position: relative;
z-index: 1;
bottom: 0;
left: 0;
width: 100%;
height: 60%;
}
.slide-background-overlay::after {
content: '';
position: absolute;
height: 60%;
width: 100%;
z-index: -1;
bottom: 0;
left: 0;
}
The original Template i use is this: https://colorlib.com/wp/template/sonar/
I modify it for my needs.
I use html/css/js from time to time but i can't find the issue.
Greetings Adrian
This is what you're trying to do, I added height: 100vh to the main container and moved the style="background: ...." inside the css in .bg-img . I also added margin: 0; padding: 0 to the body
body {
margin: 0;
paddong: 0;
}
.hero-slides .single-hero-slide {
height: 100vh;
/* You can change this to 50vh (50% of the screen width) and will still be responsive */
width: 100%;
position: relative;
z-index: 1;
-webkit-transition-duration: 800ms;
transition-duration: 800ms;
overflow: visible;
/*cursor: pointer; */
}
.hero-slides .single-hero-slide .hero-slides-content {
position: relative;
z-index: 1;
-webkit-transform: translateY(75%);
transform: translateY(75%);
-webkit-transition-duration: 800ms;
transition-duration: 800ms;
bottom: 0;
}
.hero-slides .single-hero-slide .hero-slides-content .line {
width: 100px;
height: 1px;
background-color: #ffffff;
margin-bottom: 30px;
display: block;
}
.hero-slides .single-hero-slide .hero-slides-content h2 {
color: #ffffff;
font-weight: 100;
}
.hero-slides .single-hero-slide .hero-slides-content p {
color: #ffffff;
margin-bottom: 0;
-webkit-transition-duration: 500ms;
transition-duration: 500ms;
margin-top: 140px;
}
.hero-slides .single-hero-slide:hover .hero-slides-content {
-webkit-transform: translateY(0%);
transform: translateY(0%);
}
.hero-slides .single-hero-slide:hover p {
margin-top: 40px;
}
.bg-img {
background-image: url("https://picsum.photos/5472/3648?image=1074");
background-position: center center;
background-size: cover;
background-repeat: no-repeat;
}
.slide-background-overlay {
position: relative;
z-index: 1;
bottom: 0;
left: 0;
width: 100%;
height: 60%;
}
.slide-background-overlay::after {
content: "";
position: absolute;
height: 60%;
width: 100%;
z-index: -1;
bottom: 0;
left: 0;
}
<section class="hero-area">
<div class="hero-slides">
<!-- Single Hero Slide -->
<div class="single-hero-slide bg-img slide-background-overlay">
</div>
</div>
</section>
You seem to be trying to create a responsive background image. If that's the case, you'll find below a quick hint on how to do it.
Responsive image background:
We first create a container for the background like you did with <div class="single-hero-slide bg-img slide-background-overlay"></div>
Next, you set an height and/or a width with width and height CSS properties
After that, select an image to use as background and use background-size: cover or contain
.bg-img {
width: 30vw;
height: 100vh;
background: url('https://images.pexels.com/photos/1034677/pexels-photo-1034677.jpeg?cs=srgb&dl=adult-art-man-1034677.jpg&fm=jpg');
background-size: cover;
}
<div class="single-hero-slide bg-img slide-background-overlay"></div>
Here is a reference of this property : https://developer.mozilla.org/en-US/docs/Web/CSS/background-size
Can Anyone help me to solve a problem that I found on the last version of Chrome?
I found a problem on Chrome new version regarding the DIV Background in 3D.
In the Chrome versione 61.0.3163.100 the same page was rendered well.
On Safari, Internet Explore, Edge and Firefox the page is rendered without any problem.
I attached in this message just a little part of the original HTML page in order to show which is the problem.
Thanks in advance
Andrea Angeli
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.42857143;
color: #333;
background-color: #fff;
}
.container-fluid {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
.corr-container {
text-align: center;
position: relative;
}
.cube {
-moz-perspective: 600px;
perspective: 600px;
-webkit-perspective: 600px;
position: relative;
width: 100%;
display: inline-block;
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
}
.cube {
height: 550px;
perspective-origin: 50% 275px;
-webkit-perspective-origin: 50% 275px;
}
.cube-face-top {
left: 0;
width: 100%;
height: 3300px;
transform: rotateX(-90deg);
-webkit-transform: rotateX(-90deg);
transform-origin: center top;
-webkit-transform-origin: center top;
background-image: url(https://www.trulytaly.com/ElementiGrafica/Corridoi/Nuovi/Soffitto.png);
background-size: 100% 550px;
-webkit-background-size: 100% 550px;
}
.cube-face {
position: absolute;
top: 0;
}
.plaza-face-top {
background-repeat: no-repeat;
background-image: url(https://www.trulytaly.com/ElementiGrafica/Piazze/NuoviFilePiazza/CUT-FOTOGALLERIA2-B2-TOP.jpg);
width: 100%;
height: 550px;
background-size: 100% 550px;
position: absolute;
top: 100%;
}
.plaza-face,
.r-plaza-face {
position: absolute;
top: 0;
}
.plaza-face,
.r-plaza-face {
position: absolute;
top: 0;
}
.rplaza-face-top {
background-repeat: no-repeat;
background-image: url(../ElementiGrafica/Piazze/NuoviFilePiazza/CUT-FOTOGALLERIA2-B2-TOP.jpg);
width: 100%;
height: 550px;
background-size: 100% 550px;
position: absolute;
top: -550px;
}
.dropdown-flag {
position: relative;
display: inline-block;
}
.dropdown-content-flag {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
padding: 12px 16px;
}
.dropdown-flag:hover .dropdown-content-flag {
display: block;
}
.col-sx-dx-div-principale {
display: none;
width: 0;
height: 0;
}
#media screen and (min-width: 1900px) {
.div-principale {
max-width: 90%;
position: relative;
float: left;
}
.col-sx-dx-div-principale {
display: block;
position: relative;
float: left;
background-color: white;
transform-style: preserve-3d;
transform: translateZ(20000px);
z-index: 9999999;
height: 900px;
width: 5%;
}
}
}
<div class="div-principale" style="margin: 0 auto; padding: 0;">
<div class="container-fluid" style="padding: 0px;">
<div style="padding-right:0px;padding-left:0px;" class="virtual-container">
<div class="corr-container">
<div class="cube-container">
<div id="cube" data-inverted="false" class="cube" data-p="front">
<div class="cube-face ct cube-face-top">
<div class="pt plaza-face plaza-face-top"></div>
<div class="pt plaza-face rplaza-face-top" style="display:none"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
I have one issue in current project. I am applying background image in one div and also set opacity over it using :after.. Inside it, I have taken one another div which has border & content but I need to highlight middle section without opacity using same background image.
Sample Screenshot
.first_resorts_list_right { float: left; width: 434px; overflow: hidden; height: 477px; background-size: cover!important; background: no-repeat; padding: 70px; position: relative; background-image: url(http://s17.postimg.org/fa4ru3hm7/test.jpg); }
.resort-info { border: 10px solid #fff; padding: 20px; text-align: center; color: #000; font-size: 40px; }
.bannerimage2 { display: none; }
.expose { position: relative; z-index: 99999; }
.overlay-img { background: rgba(255,255,255,0.3); width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 99998; }
<div class="first_resorts_list_right">
<div class="resort-info expose">Content</div>
<div class="overlay-img"></div>
</div>
I made an alternative version, with divs wraping divs (plus sharing the same background values) instead of use :after
body {
width:100%;
height: 100vh;
margin: 0px;
font-family: arial, sans-serif;
}
#container {
width:100%;
height:100%;
position: relative;
}
#big {
top:0;
left:0;
width:100%;
height: 100%;
background-image: url("http://i.imgur.com/wvIxNg1.jpg");
background-size: 100vw 100vh;
background-repeat: no-repeat;
background-position: center;
position: relative;
-webkit-filter: blur(5px); /* Chrome, Safari, Opera */
filter: blur(5px);
}
#small {
position: absolute;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
width: 70%;
height: 70%;
outline: 4px solid white;
left: 0;
right: 0;
margin: auto;
background-image: url("http://i.imgur.com/wvIxNg1.jpg");
background-size: 100vw 100vh;
background-position: center;
background-repeat: no-repeat;
text-align: center;
color: white;
-webkit-filter: contrast(120%); /* Chrome, Safari, Opera */
filter: contrast(120%);
}
#white {
width:100%;
height: 100%;
background-color: white;
opacity: 0.1;
}
h1 {
font-weight: 100;
position: absolute;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
left: 0;
right: 0;
margin: auto;
letter-spacing:8px;
}
<div id=container>
<div id=big>
<div id=white></div>
</div>
<div id=small><h1>FOCUS</h1></div>
</div>
I have a link in the final div (slide4) and it is not working. I've messed around with z-index and positioning but that didn't work.
This is my first time messing around with a parallax design and I'm using a template to familiarize myself with it, but I hit a snag in this and can't figure it out.
Here's the codepen: http://codepen.io/anon/pen/bdGcI
CSS:
<style type="text/css">
html {
height: 100%;
overflow: hidden;
}
`body {
margin:0;
padding:0;
perspective: 1px;
transform-style: preserve-3d;
height: 100%;
overflow-y: scroll;
overflow-x: hidden;
font-family: Oswald;
}`body {
margin:0;
padding:0;
perspective: 1px;
transform-style: preserve-3d;
height: 100%;
overflow-y: scroll;
overflow-x: hidden;
font-family: Oswald;
}
a:link {
text-decoration: none;
color: #fff;
}
a:visited {
text-decoration: none;
color: #ccc;
}
a:hover {
text-decoration: underline;
color: #B22222;
}
a:active {
text-decoration: underline;
}
h1 {
font-size: 550%
}
h2 {
font-size: 250%
}
p {
font-size: 140%;
line-height: 150%;
color: #333;
}
p2 {
font-size: 300%;
line-height: 150%;
color: #fff;
}
.slide {
position: relative;
padding: 25vh 10%;
min-height: 100vh;
width: 100vw;
box-sizing: border-box;
box-shadow: 0 -1px 10px rgba(0, 0, 0, .7);
transform-style: inherit;
}
img {
position: absolute;
top: 50%;
left: 35%;
width: 320px;
height: 240px;
transform: translateZ(.25px) scale(.75) translateX(-94%) translateY(-100%) rotate(2deg);
padding: 1px;
border-radius: 10px;
background: rgba(240,230,220, .7);
box-shadow: 0 0 1px rgba(0, 0, 0, .7);
}
img:last-of-type {
transform: translateZ(.4px) scale(.6) translateX(-104%) translateY(-40%) rotate(-5deg);
}
.slide:before {
content: "";
position: absolute;
top: 0;
bottom: 0;
left:0;
right:0;
}
.title {
width: 50%;
padding: 2%;
border-radius: 5px;
background: rgba(240,230,220, .7);
box-shadow: 0 0 8px rgba(0, 0, 0, .7);
}
.slide:nth-child(2n) .title {
margin-left: 0;
margin-right: auto;
}
.slide:nth-child(2n+1) .title {
margin-left: auto;
margin-right: 0;
}
.slide, .slide:before {
background: 50% 50% / cover;
}
.header {
text-align: center;
font-size: 175%;
color: #fff;
text-shadow: 0 4px 4px #000;
}
.header2 {
text-align: center;
font-size: 175%;
color: #fff;
}
#title {
background-image: url("bg2");
background-attachment: fixed;
}
#slide1:before {
background-image: url("bg3");
transform: translateZ(-1px) scale(2);
z-index:-1;
}
#slide2 {
background-image: url("bg4");
background-attachment: fixed;
}
#slide3:before {
background-image: url("bgbg");
transform: translateZ(-1px) scale(2);
z-index:-1;
}
#slide4 {
background: #222;
}
</style>
</head>
HTML in question:
<div id="slide3" class="slide">
<div class="title">
<h2>Music</h2>
<p>words words words.</p>
</div>
</div>
<div id="slide4" class="slide header2">
Final Page Link.
</div>
Because :before pseudo class is causing an overlay over the content as you have written
.slide:before {
content: "";
position: absolute;
/*top:0;*/ /*remove this */
bottom: 0;
left:0;
right:0;
}
Code pen Demo
You have .slide:before with position:absolute; if you remove that it will work, so your problem is that Absolute position is Over the Link and content. If you add position:relative; to ahref or add relative to new Container inside #slide4, it will work..
1http://codepen.io/anon/pen/HGIiF/