responsive image carousel with one last image - html

I'm working hard on making a responsive image carousel but in the last stage (which I will explain) I can't get something to work. First let me give you what I have now, and then I will explain what suppose to happen.
html, body {
margin: 0;
overflow-x: hidden;
}
.vp-carousel {
width: 1000px;
height: 228px;
overflow: hidden;
margin-left: 50%;
transform: translate(-50%);
margin-top: 150px;
position: relative;
}
.carousel-wrapper {
height: 228px;
width: calc((1000px / 3) * 4);
}
.carousel-box {
display: inline-block;
width: calc(1000px / 3);
height: 100%;
margin-right: -4px;
position: relative;
}
.carousel-box img {height: 100%; width: 100%; }
.title {
position: absolute;
color: white;
z-index: 2;
height: 60px;
width: 100%;
text-align: center;
line-height: 30px;
top: calc(100% - 60px);
}
.mask {
width: 100%;;
height: 100%;
background-color: rgba(0,0,0,0.5);
position: absolute;
z-index: 1
}
#media screen and (max-width: 1080px) {
.vp-carousel {
width: calc(1000px * 0.66);
}
}
#media screen and (max-width: 700px) {
.vp-carousel {
width: calc(1000px * 0.33);
}
}
<div class="portfolio">
<div class="vp-carousel">
<div class="carousel-wrapper">
<div class="carousel-box">
<div class="title">
<p>Joomla! Website</p>
</div>
<div class="mask"></div>
<img src="http://www.hdwallpapers.in/walls/autumn_bench-HD.jpg">
</div>
<div class="carousel-box">
<div class="title">
<p>Joomla! Website</p>
</div>
<div class="mask"></div>
<img src="http://www.hdwallpapers.in/walls/autumn_bench-HD.jpg">
</div>
<div class="carousel-box">
<div class="title">
<p>Joomla! Website</p>
</div>
<div class="mask"></div>
<img src="http://www.hdwallpapers.in/walls/autumn_bench-HD.jpg">
</div>
<div class="carousel-box">
<div class="title">
<p>Joomla! Website</p>
</div>
<div class="mask"></div>
<img src="http://www.hdwallpapers.in/walls/autumn_bench-HD.jpg">
</div>
</div>
</div>
</div>
So what you see here is my simplified image carousel (to make it more clear), and in the last stage it show only one image (good!) but it's very small relative to the screen width of 700px (media query). What I want it to do is that it all increases to a bigger size (in ratio) and when the screen width gets smaller the image carousel decreases in size (in ratio).

Related

How do I make my image insert in the circle and get centered in the .s-circles-1

How do I make my image gets centered in the .s-circles-1 <div>...
Html
.s-circles-1 {
display: inline-block;
opacity: 0.1;
margin-left: 315px;
margin-top: 155px;
background-color: #fff;
width: 164px;
height: 164px;
border-radius: 100%;
position: relative;
}
.s-img-1 {
opacity: 0.9;
display: inline-block;
position: absolute;
color: #E37218;
margin-right: 70vw;
width: 120px;
height: 120px;
}
<div class="services">
<div class="s-text">
<h2>Services</h2>
</div>
<div class="s-circles-1">
<img src="/Shapes/code (1).svg" alt="" class="s-img-1">
</div>
</div>
I am trying to make my image get inserted in the circle.
Thanks in advance.
With background-image :
div.circle {
background-position: center;
background-repeat: no-repeat;
background-size: cover;
border-radius: 100%;
width: 164px;
aspect-ratio : 1 / 1;
}
<div class="services">
<div class="s-text">
<h2>Services</h2>
</div>
<div class="circle" style="background-image: url(https://thispersondoesnotexist.com/image)"></div>
</div>
With your code, you need to change your css with this (if you don't want to use background-image) :
s-circles-1 class : set overflow:hidden;
s-img-1 class : set
width:100%; and height:100%;
.s-circles-1 {
display: inline-block;
opacity: 0.5;
width: 164px;
aspect-ratio:1 / 1; /* Keep the same width */
border-radius: 100%;
overflow: hidden;
}
.s-circles-1 img {
opacity: 0.9;
width: 100%;
height: 100%;
}
<div class="services">
<div class="s-text">
<h2>Services</h2>
</div>
<div class="s-circles-1">
<img src="https://thispersondoesnotexist.com/image" alt="">
</div>
</div>
With your code, but if your image is not a square :
div.circle {
display: flex;
justify-content: center;
align-items: center;
border-radius: 100%;
width: 164px;
aspect-ratio : 1 / 1;
overflow: hidden;
}
div.circle img {
/*if width > height*/
height: 164px;
/*if height > width*/
/*width: 164px;*/
}
<div class="services">
<div class="s-text">
<h2>Services</h2>
</div>
<div class="circle">
<img src="https://dummyimage.com/1200x500/000/fff" alt="" class="circle">
</div>
</div>

CSS: Absolute div and media query

I assume this has been posted before and I apologize in advance, I'm afraid I didn't find the solution.
My issue: I have a design with two divs, one must be transparent on top of the other. I was able to achieve that with div 1: position relative and div 2: position absolute, z-index: 1. However the page must be responsive and I cannot change the size of the absolute div.
Somehow, I need to find a way to make the transparent absolute div responsive with media query.
Basically, this is the desired design:
.main {
display: flex;
}
.content {
height: 200px;
padding-left: 36px;
padding-right: 100px;
position: relative;
flex: 1;
background-color: lightblue;
}
.visual {
width: 200px;
height: 300px;
position: absolute;
z-index: 1;
right: 24px;
background-color:rgba(106, 132, 226, 0.1);
<div class="main">
<div class="content">
<h1 id="header">title</h1>
</header>
<div class="description">
<h3 id="description-text">Text</h3>
</div>
</div>
<div class="visual">
<h3>Transparent div</h3>
</div>
</div>
</div>
change width to percent instead of px
and for media query, you must set width for each query.
* {
border: 1px solid red;
}
.main {
display: flex;
}
.content {
height: 200px;
padding-left: 36px;
padding-right: 100px;
position: relative;
flex: 1;
background-color: lightblue;
}
.visual {
width: 700px;
height: 300px;
position: absolute;
z-index: 1;
right: 24px;
background-color:rgba(106, 132, 226, 0.1);
}
#media only screen and (max-width: 600px) {
.visual {
width: 400px;
}
}
<div class="main">
<div class="content">
<h1 id="header">title</h1>
</header>
<div class="description">
<h3 id="description-text">Text</h3>
</div>
<div class="visual">
<h3>Transparent div</h3>
</div>
</div>

Issue when resizing overlay on Parallax

I just bought this template.
When resizing the window under 991px, the overlay does not fit the section because of padding 60px. Do you know what I can do to resolve this ?
HTML
<div class="parallax-content">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="info">
<p>We design and develop <span>web apps</span> that delight your users and grow your business.</p>
<a class="btn-white-line" href="#">Contact Us</a>
</div>
</div>
</div>
</div>
</div>
CSS
.parallax {
min-height: 215px;
overflow: hidden;
position: relative;
padding-top: 60px;
padding-bottom: 60px;
}
.parallax:before {
content: '';
position: absolute;
width: 140%;
height: 140%;
opacity: .80;
background: #585CE9;
z-index: 2;
top: -20%;
left: -20%;
}
.parallax .parallax-content {
position: relative;
z-index: 3;
}
#media (max-width: 991px) {
.parallax {
padding-top: 60px;
padding-bottom: 60px;
min-height: auto;
}
}

How to make responsive 3 image which has different scale?

I'm working in Wordpress and i need to insert 3 image in a row.
I'm using default editor because of my client ask that.
Insert the 3 image html for the page and then give this a little CSS with simple CSS plugin :
It's okay, the 3 image appear in a row, which has 170px height, but when i open this in mobile or tablet the scale isn't responsive.
I try to make container which has 170px height, and put the image them but wasn't working. I try to make #media query but that wasn't work.
Anyone can help me ?
I want if these 3 picture is got ca. 170px and being responsive.
* {
box-sizing: border-box;
}
.tanfolyam-kepek {
float: left;
width: 33.33%;
padding: 10px;
height: 170px;
}
.clearfix::after {
content: "";
clear: both;
display: table;
}
<div class="clearfix">
<div class="box">
<img class="tanfolyam-kepek" src="https://ezoakademia.hu/wp-content/uploads/2018/12/rozsakvarc1-226x300.jpg" alt=""/>
</div>
<div class="box">
<img class="tanfolyam-kepek" src="https://ezoakademia.hu/wp-content/uploads/2018/12/rozsakvarc2-300x300.jpg" alt=""/>
</div>
<div class="box">
<img class="tanfolyam-kepek"src="https://ezoakademia.hu/wp-content/uploads/2018/12/rozsakvarc3-300x243.jpg" alt=""/>
</div>
</div>
Responsive images on a row. Verttical and horizontal alignment. No use of clearfix. Cross browser.
<div class="box-container">
<div class="box">
<a href="https://ezoakademia.hu/wp-content/uploads/2018/12/rozsakvarc1.jpg">
<img class="tanfolyam-kepek" src="https://ezoakademia.hu/wp-content/uploads/2018/12/rozsakvarc1-226x300.jpg" alt=""/>
</a>
</div>
<div class="box">
<a href="https://ezoakademia.hu/wp-content/uploads/2018/12/rozsakvarc2.jpg">
<img class="tanfolyam-kepek" src="https://ezoakademia.hu/wp-content/uploads/2018/12/rozsakvarc2-300x300.jpg" alt=""/>
</a>
</div>
<div class="box">
<a href="https://ezoakademia.hu/wp-content/uploads/2018/12/rozsakvarc3.jpg">
<img class="tanfolyam-kepek"src="https://ezoakademia.hu/wp-content/uploads/2018/12/rozsakvarc3-300x243.jpg" alt=""/>
</a>
</div>
</div>
with css
* {
box-sizing: border-box;
}
.box-container {
height: 170px; /* height you asked for */
outline: thin dotted grey; /* this outline for test only */
}
#media (max-width: 575.9px) {
.box-container {
height: ...px; /* for mobile, for example 140px */
}
}
.box {
float: left;
width: 33.333%;
height: 100%;
text-align: center; /* horizontal alignment */
}
.box a {
display: block;
/* 5 lines below for vertical alignment */
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
.box img {
max-width: 100%;
height: auto; /* responsive image */
max-height: 170px; /* no overflow */
border: 10px solid #fff; /* border used as padding */
}
you can use bootstrap grid to make your images responsive. all you have to do is
<div class="row">
<div class="col-sm-4 col-xs-4>
//your image here
</div>
<div class="col-sm-4 col-xs-4>
//your image here
</div>
<div class="col-sm-4 col-xs-4>
//your image here
</div>
</div>
And avoid using px to specify the size since it is not responsive. Use vh and vw which stand for viewport height and viewport width respectively
.box{
display: inline-block;
width: 31.3%;
height: 200px;
text-align: center;
border: 1px solid #ddd;
padding: 20px 0;
margin: 10px;
}
.box img{
vertical-align: middle;
display: inline-block;
height: 100%;
max-width: none;
width: auto;
}
You can have something like this for have always tree picters in a row.
* {
box-sizing: border-box;
}
.tanfolyam-kepek {
float: left;
width: 33.33%;
padding: 10px;
height: 170px;
object-fit: cover;
}
.clearfix::after {
content: "";
clear: both;
display: table;
}
<div class="clearfix">
<div class="box">
<img class="tanfolyam-kepek" src="https://ezoakademia.hu/wp-content/uploads/2018/12/rozsakvarc1-226x300.jpg" alt=""/>
</div>
<div class="box">
<img class="tanfolyam-kepek" src="https://ezoakademia.hu/wp-content/uploads/2018/12/rozsakvarc2-300x300.jpg" alt=""/>
</div>
<div class="box">
<img class="tanfolyam-kepek"src="https://ezoakademia.hu/wp-content/uploads/2018/12/rozsakvarc3-300x243.jpg" alt=""/>
</div>
</div>

Mobile Safari: Image with 100% height not visible in absolute positioned container

Demo: http://codepen.io/malte/pen/kDlbt
I am using an absolute positioned wrapper to center an image in a thumbnail frame. (Only) On mobile safari, the image won't be displayed. if you inspect the .image-pos container you'll see that the height is properly set to its parent's size. applying a fixed px height to it will make the image show up... Does anyone know how to fix that?
It's working on any Desktop browser...
HTML:
<div class="wrapper">
<div class="thumb-grid">
<div class="thumb">
<a href="#" class="image">
<div class="image-pos">
<img src="http://images.weserv.nl/?url=static.living.is/gallery/original/5184f3631034bcdf16bd4d37c341928e.jpg&il&w=600" />
</div>
</a>
<div class="details">
<h5>Image Title</h5>
</div>
</div>
<div class="thumb">
<a href="#" class="image">
<div class="image-pos">
<img src="http://images.weserv.nl/?url=static.living.is/gallery/original/5184f3631034bcdf16bd4d37c341928e.jpg&il&w=600" />
</div>
</a>
<div class="details">
<h5>Image Title</h5>
</div>
</div>
<div class="thumb">
<a href="#" class="image">
<div class="image-pos">
<img src="http://images.weserv.nl/?url=static.living.is/gallery/original/016e551de2f53d58e7f4acd68279e6a1.JPG&il&w=600" />
</div>
</a>
<div class="details">
<h5>Image Title</h5>
</div>
</div>
</div>
</div>
CSS:
.wrapper {
width: 600px;
margin: 30px auto 0
}
.thumb-grid {
text-align: justify;
}
.thumb-grid:after {
content: '';
display: inline-block;
width: 100%;
}
.thumb {
position: relative;
display: inline-block;
width: 31.5%;
height: 0;
padding-top: 29%;
margin-bottom: 6%;
}
.image {
height: 73%;
overflow: hidden;
position: absolute;
text-align: center;
top: 0;
width: 100%;
vertical-align: top;
display: block;
border: 1px solid #eee;
}
.image-pos {
height: 100%;
left: 50%;
margin-left: -300px;
position: absolute;
text-align: center;
width: 600px;
}
.image-pos img {
height: 100%;
max-height: 100%;
min-height: 100%;
max-width: none;
width: auto;
display: inline;
border: 0;
}
.details {
height: 27%;
position: absolute;
top: 73%;
}
.details h5 {
margin: 0;
padding-top: 5px;
}
Demo: http://codepen.io/malte/pen/kDlbt