Needed CSS for mobile banner portrait view - css

I am uploading 3 banners slides from my admin section thru PHP. The banner looks fine on the desktop top and mobile landscape view. But the mobile Portrait view does seems right , I would like the banner to reduce to fit in the mobile for portrait view.-site- www.shoeshineindia.com
<section class="section-slide">
<div class="wrap-slick1">
<div class="slick1">
<div class="item-slick1" style="background-image: url(<?php echo $imagename[1];?>)">
<div class="container h-full">
<div class="flex-col-l-m h-full p-t-100 p-b-30 respon5">
<div class="layer-slick1 animated visible-false" data-appear="fadeInDown" data-delay="0">
<span class="ltext-101 cl2 respon2">
</span>
</div>
CSS-used for one banner-
[ Slick1 ]*/
.wrap-slick1 {
position: relative;
}
.item-slick1 {
height: calc(100vh - 40px);
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
}
.rs1-slick1 .item-slick1 {
height: calc(100vh - 84px);
}
.rs2-slick1 .item-slick1 {
height: 100vh;
}
#media (max-width: 991px) {
.item-slick1 {
height: calc(100vh - 70px) !important;
}
}
.arrow-slick1 {
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
justify-content: center;
align-items: center;
width: auto;
height: auto;
font-size: 80px;
color: rgba(0,0,0,0.3);
position: absolute;
opacity: 0;
top: 50%;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
z-index: 200;
-webkit-transition: all 0.4s;
-o-transition: all 0.4s;
-moz-transition: all 0.4s;
transition: all 0.4s;
}
.wrap-slick1:hover .arrow-slick1 {
opacity: 1;
}
.arrow-slick1:hover {
color: #7280e0;
}
.next-slick1 {
right: 50px;
left: auto;
}
.prev-slick1 {
left: 50px;
right: auto;
}
#media (max-width: 991px) {
.next-slick1 {
right: 15px;
}
.prev-slick1 {
left: 15px;
}
}
Note -
Issue here is that the banner works fine on the desktop and mobile landscape But in mobile PORTRAIT it does not. it shows just the center of the banner.Need to view the banner as it looks like in the desktop and mobile landscape.

Related

Image is not in center on safari mobile web

I implemented css animation to the image and it works well on explorer or chrome through the pc.
Though, on safari, the image is placed in the left top corner. Since I'm using position: absolute and relative for animation, I can't use display:flex option.
Plus, as you can see from below ss, card size is also not fit as applied in css, and have weird space between card and buttons.
current status on safari
Here is my current code:
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
img {
vertical-align: middle;
}
.container {
width: 100%;
height: 100vh;
overflow: hidden;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-image: url("../../images/background-forloading.jpg");
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}
.flip-card {
width: 100%;
height: 80vh;
perspective: 1600px;
cursor: pointer;
transform: translateY(40px) rotateX(-8deg) rotateY(10deg);
animation: movement 5s infinite;
}
#keyframes movement {
50% {
transform: translateY(-40px) rotateX(8deg) rotateY(-10deg);
}
}
.flip-card div {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
backface-visibility: hidden;
transition: 0.7s;
width: 100vw;
height: 80vh;
}
.flip-card div img {
width: 100vw;
height: 80vh;
object-fit: contain;
}
.front {
filter: drop-shadow(0 0 30px #000);
}
.back {
transform: rotateY(180deg);
}
.flip-card:hover .front {
transform: rotateY(-180deg);
}
.flip-card:hover .back {
transform: rotateY(0);
filter: drop-shadow(0 0 20px rgb(120, 185, 232));
}
<div class="container">
<div class="flip-card">
<div class="front">
<img src="images/귀문관카드뒤.png">
</div>
<div class="back">
<img src="images/인간.png">
</div>
</div>
<div class="flip-card-button text-center">
<button class="enter">Save</button>
<button type="submit" class="enter">Next</button>
</div>
</div>
I'm not sure if it solves your problem, but your code is currently missing the browser prefixes.
-webkit- for Chrome, Safari, Opera, iOS
-moz- Firefox
-ms- Internet Explorer and Edge

css transition on one image causes nearby images jitter

Why a mouse over transition in one image causing a jitter in nearby images?
The images are large and fits in the div with width:100%.
Observed the issue in chrome.
.post:hover figure img {
transform: scale(1.03);
}
.post img {
transition: all cubic-bezier(.4,0,.2,1) .3s;
transform: scale(1);
}
/* Main Div css start here */
.slide_Wrapper {
display: flex;
}
/* This is for child div */
.slide {
width: 290px;
height: 160px;
overflow: hidden;
background: #000;
margin:10px;
display: flex;
justify-content: center;
align-items: center;
position: relative;
border-radius: 10px;
}
/* This is for child div border */
.slide::after {
content: "";
position: absolute;
width: 90%;
height: 82%;
border: 2px solid #fff;
left: 50%;
top: 50%;
z-index: 2;
transform: translate(-50%,-50%);
}
/* Background images */
.slide img {
width: 100%;
height: 100%;
object-fit: cover;
transition: all cubic-bezier(.4,0,.2,1) .3s;
transform: scale(1);
position: absolute;
}
/* Background images on hover */
.slide:hover img {
transform: scale(1.2);
}
/* Text */
.slide h2{
position: relative;
z-index: 2;
color: #fff;
}
<!-- Here I create a main div and two child div -->
<div class="slide_Wrapper">
<div class="slide">
<img src="https://images.pexels.com/photos/1591447/pexels-photo-1591447.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260">
<h2>XYZ</h2>
</div>
<div class="slide">
<img src="https://images.pexels.com/photos/1591447/pexels-photo-1591447.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260">
<h2>ABC</h2>
</div>
</div>

How to make slanted images fit within 100% of viewport width?

I am having some difficulty getting slanted images to fit within 100% of my viewport width. Specifically,
div two-images-outer and two-images-inner are currently outside the 100% width of the viewport. I want to get it in line with the rest of the sections below (see image). Any help is greatly appreciated!
Image to illustrate problem of image div extending beyond 100% width of the viewport the image div is extending in order to obtain the skewed slant:
HTML:
<section>
<div class="three-images-wrapper">
<div class="three-images">
<div class="featured-image-outer">
<div class="featured-image-inner"
style="background-image: url(../img/servicesheader1.jpeg);">
<h1>Services</h1>
</div>
</div>
<div class="two-images">
<div class="two-images-outer">
<div class="two-images-inner">
<div class="image1"
style="background-image: url('../img/servicesheader2.jpeg');">
</div>
</div>
</div>
</div>
</div>
</div>
</section>
CSS:
.three-images-wrapper {
height: 300px;
width: 100%;
}
.three-images {
margin-bottom: 4rem;
min-height: 300px;
position: relative;
}
.featured-image-outer {
position: absolute;
margin-left: -15%;
min-height: 360px;
overflow: hidden;
width: 76.5%;
-ms-transform: skew(-15deg,0deg); /* IE 9 */
-webkit-transform: skew(-15deg,0deg); /* Safari */
transform: skew(-15deg,0deg); /* Standard syntax */
}
.featured-image-inner,
.two-images-inner {
background-size: cover;
background-position: center;
}
.featured-image-inner {
left: 50px;
position: absolute;
top: 0;
height: 300px;
width: 100%;
-ms-transform: skew(15deg,0deg); /* IE 9 */
-webkit-transform: skew(15deg,0deg); /* Safari */
transform: skew(15deg,0deg); /* Standard syntax */
}
.two-images {
min-height: 300px;
position: relative;
right: -63vw;
top: 0;
width: 55%;
}
.two-images-outer {
min-height: 130px;
overflow: hidden;
position: absolute;
width: 100%;
-ms-transform: skew(-15deg,0deg); /* IE 9 */
-webkit-transform: skew(-15deg,0deg); /* Safari */
transform: skew(-15deg,0deg); /* Standard syntax */
}
.two-images-inner {
-ms-transform: skew(15deg,0deg); /* IE 9 */
-webkit-transform: skew(15deg,0deg); /* Safari */
transform: skew(15deg,0deg); /* Standard syntax */
}
.image1
{
position: relative;
height: 300px;
right: 19%;
width: 100%;
background-position: center;
background-size: cover;
background-clip: content-box;
}
You can use clip-path and it will be easier
.container {
height: 300px;
display:flex;
}
.container > * {
background-position: center;
background-size: cover;
flex:1;
}
.container > :first-child {
clip-path:polygon(0 0,100% 0,calc(100% - 100px) 100%,0 100%);
margin-right:-40px;
}
.container > :last-child {
clip-path:polygon(100px 0,100% 0,100% 100%,0 100%);
margin-left:-40px;
}
<div class="container">
<div style="background-image: url(https://picsum.photos/id/10/800/800);">
<h1>Services</h1>
</div>
<div style="background-image: url(https://picsum.photos/id/14/800/800);">
</div>
</div>

Issue with CSS and display flex

I have an issue with my CSS based page.
I would like to change the background-image on mouse-over the two div and point to another page when click.
I have 3 issues:
The change of background works fine when the screen is in portrait resolution but not in landscape.
I would like to have a fade animation on the background change but I couldn't figure out how.
I would need div1 and div2 to be link so that not only the background change, it also point to another page if user click. I couldn't add on the div without blocking the flex display.
Thank you!
* {
padding: 0;
margin: 0;
}
html,
body {
height: 100%;
text-align: center;
}
#media screen and (orientation:landscape) {
.container {
position: absolute;
display: flex;
width: 75vmin;
height: 100vmin;
top: 50%;
left: 50%;
transform: translate3d(-50%, -50%, 0);
}
.div1,
.div2 {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
width: 32.5vmin;
height: 100vmin;
background-color: #ddd;
}
}
#media screen and (orientation:portrait) {
.container {
position: absolute;
display: flex;
width: 100vmin;
height: 133vmin;
top: 50%;
left: 50%;
transform: translate3d(-50%, -50%, 0);
}
.div1,
.div2 {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
width: 50vmin;
height: 133vmin;
background-color: hsla(0, 0%, 0%, 0.1);
}
}
.background1,
.background2 {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: none;
z-index: -1;
}
.background1 {
background: url("http://i.imgur.com/zFYHM67.jpg");
background-repeat: no-repeat;
background-size: cover;
}
.background2 {
background: url("http://i.imgur.com/nYKEFNF.jpg");
background-repeat: no-repeat;
background-size: cover;
}
.div1:hover~.background1 {
display: flex;
}
.div2:hover~.background2 {
display: flex;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="div1">Div 1</div>
<div class="background1"></div>
<div class="div2">Div 2</div>
<div class="background2"></div>
</div>
</body>
</html>
I made some changes in your code (mainly css) see the snippet below:
for issue 1 : you were using #media screen and (orientation:portrait) so the style inside only works for portrait
for issue 2 : i used opacity and transition to have an animation effect
for issue 3: i just changed div tag to a tag
* {
padding: 0;
margin: 0;
}
html,
body {
height: 100%;
text-align: center;
}
#media screen and (orientation:landscape) {
.container {
position: absolute;
display: flex;
width: 75vmin;
height: 100vmin;
top: 50%;
left: 50%;
transform: translate3d(-50%, -50%, 0);
}
.div1,
.div2 {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
width: 32.5vmin;
height: 100vmin;
background-color: #ddd;
}
}
.container {
position: absolute;
display: flex;
width: 100vmin;
height: 100vmin;
top: 50%;
left: 50%;
transform: translate3d(-50%, -50%, 0);
}
.div1,
.div2 {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
width: 50vmin;
height: 100vmin;
background-color: hsla(0, 0%, 0%, 0.1);
}
.background1,
.background2 {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
opacity: 0;
z-index: -1;
transition: all 1s;
}
.background1 {
background: url("https://www.w3schools.com/css/img_fjords.jpg");
background-repeat: no-repeat;
background-size: cover;
}
.background2 {
background: url("https://www.w3schools.com/howto/img_mountains.jpg");
background-repeat: no-repeat;
background-size: cover;
}
.div1:hover~.background1 {
display: flex;
opacity: 1;
}
.div2:hover~.background2 {
display: flex;
opacity: 1;
}
<div class="container">
Div 1
<div class="background1"></div>
Div 2
<div class="background2"></div>
</div>

CSS3 animation/keyframes, transforming with vw in IE11 issues

I'm animating an element across a screen, but in IE11, weird things are happening. I'm in development, so I can't share the live code. But I created a fiddle to replicate the problem.
Basically, when I use viewport width aka vw with transform:translateX(); inside a #keyframes to use in an animation, IE11 doesn't reflect the width of the viewport in the animation.
So the Fiddle I created takes an element that is positioned in the center of the viewport:
starts it at the left edge of the screen with half of the element
appearing
moves to the center of the viewport, pauses
and then moves to the right edge of the viewport, with half the element off of the screen
Fiddle: https://jsfiddle.net/Bushwazi/7xe0wy8z/4/
In the website I'm working on, IE11 animates the element as if the
page were 10 times wider
In the fiddle, the animation runs in reverse
and never makes it to the edge of the page.
So in both cases, IE11 isn't using the correct width for vw inside CSS animations.
HTML:
<!--
The animation on the red block should start half on the screen, pause at the center of the screen and then finish by pausing at the edge of the screen, half of the box off of the screen
-->
<article>
<p>IE11 weirdness when transforming vw inside keyframes</p>
<strong><span>BLOCK</span></strong>
</article>
CSS:
* {
margin: 0;
padding: 0;
}
#-webkit-keyframes movee {
0% {
-webkit-transform: translateX(-50vw);
transform: translateX(-50vw)
}
10% {
-webkit-transform: translateX(-50vw);
transform: translateX(-50vw)
}
40% {
-webkit-transform: translateX(0vw);
transform: translateX(0vw)
}
60% {
-webkit-transform: translateX(0vw);
transform: translateX(0vw)
}
90% {
-webkit-transform: translateX(50vw);
transform: translateX(50vw)
}
100% {
-webkit-transform: translateX(50vw);
transform: translateX(50vw)
}
}
#keyframes movee {
0% {
-webkit-transform: translateX(-50vw);
transform: translateX(-50vw)
}
10% {
-webkit-transform: translateX(-50vw);
transform: translateX(-50vw)
}
40% {
-webkit-transform: translateX(0vw);
transform: translateX(0vw)
}
60% {
-webkit-transform: translateX(0vw);
transform: translateX(0vw)
}
90% {
-webkit-transform: translateX(50vw);
transform: translateX(50vw)
}
100% {
-webkit-transform: translateX(50vw);
transform: translateX(50vw)
}
}
body {
background-color: #eee;
background-image: -webkit-linear-gradient(left, black 50%, transparent 50.01%);
background-image: linear-gradient(90deg, black 50%, transparent 50.01%);
background-size: 20% 100%;
background-position: 0 0;
font-family: sans-serif;
height: 100vh;
}
article {
position: relative;
height: 100%;
width: 100%;
display: block;
}
p {
width: 100%;
background: #FFF;
text-align: center;
padding: 1em 0;
}
strong {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
height: 100px;
width: 100px;
background: red;
border: blue solid 3px;
position: absolute;
top: 50%;
left: 50%;
box-sizing: border-box;
text-align: center;
margin: -50px 0 0 -50px;
-webkit-animation: movee 5.0s linear infinite 0.0s;
animation: movee 5.0s linear infinite 0.0s;
}
According to caniuse:
In IE 10 and 11, using vw units with 3D transforms causes unexpected behavior
Although 2D & 3D transforms are different, it is likely that they are handled by simliar methods within a browser. So I would say that VW/VH/VMAX/VMIN are not supported in IE11 for transitions.
Is there any reason you don't want to use % ?
Like this:
* {
margin: 0;
padding: 0;
}
#-webkit-keyframes movee {
0% {
left: -1%;
}
10% {
left: -1%;
}
40% {
left: 50%;
}
60% {
left: 50%;
}
90% {
left: 101%;
}
100% {
left: 101%;
}
}
#keyframes movee {
0% {
left: -1%;
}
10% {
left: -1%;
}
40% {
left: 50%;
}
60% {
left: 50%;
}
90% {
left: 101%;
}
100% {
left: 101%;
}
}
body {
background-color: #eee;
background-image: -webkit-linear-gradient(left, black 50%, transparent 50.01%);
background-image: linear-gradient(90deg, black 50%, transparent 50.01%);
background-size: 20% 100%;
background-position: 0 0;
font-family: sans-serif;
height: 100vh;
}
article {
border: thin dotted green;
position: relative;
height: 100%;
width: 100%;
display: block;
}
p {
width: 100%;
background: #FFF;
text-align: center;
padding: 1em 0;
}
strong {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
height: 100px;
width: 100px;
background: red;
border: blue solid 3px;
position: absolute;
top: 50%;
left: 50%;
box-sizing: border-box;
text-align: center;
margin: -50px 0 0 -50px;
-webkit-animation: movee 5.0s linear infinite 0.0s;
animation: movee 5.0s linear infinite 0.0s;
}
<!--
The animation on the red block should start half on the screen, pause at the center of the screen and then finish by pausing at the edge of the screen, half of the box off of the screen
-->
<article>
<p>IE11 weirdness when transforming vw inside keyframes</p>
<strong><span>BLOCK</span></strong>
</article>
One posibility would be to use transform as percentages.
Since you want the amout of the transform to be 100vw, lets set an extra element with a width of 100vw. Now, the transform on this element is just 100%.
I had to use negative offsets to avoid the appearance of an undesired horizontal scrollbar
* {
margin: 0;
padding: 0;
}
#keyframes movee {
0% {
transform: translateX(-100%)
}
10% {
transform: translateX(-100%)
}
40% {
transform: translateX(-50%)
}
60% {
transform: translateX(-50%)
}
90% {
transform: translateX(0%)
}
100% {
transform: translateX(0%)
}
}
body {
background-color: #eee;
background-image: linear-gradient(90deg, black 50%, transparent 50.01%);
background-size: 20% 100%;
background-position: 0 0;
height: 100vh;
}
article {
position: relative;
height: 100%;
width: 100%;
display: block;
}
p {
width: 100%;
background: #FFF;
text-align: center;
padding: 1em 0;
}
.base {
width: 100vw;
animation: movee 5.0s linear infinite 0.0s;
top: 50%;
position: absolute;
height: 100px;
}
strong {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
height: 100px;
width: 100px;
background: red;
border: blue solid 3px;
position: absolute;
right: 0px;
top: 0px;
box-sizing: border-box;
text-align: center;
margin: -50px 0 0 -50px;
}
<article>
<p>IE11 weirdness when transforming vw inside keyframes</p>
<div class="base">
<strong><span>BLOCK</span></strong>
</div>
</article>

Resources