I am trying to make a node that can zoom its picture when hovered upon. Everything works fine on Chrome and Mozilla. However, for some reason Safari gets buggy every time the image is on hover. The border radius disappears when hovered into a sharp edge and reappears when un-hovered. Here is an example: FIDDLE
.img-zoom {
top: 0;
left: 0;
margin: 0;
display: block;
width: 100%;
height: 60%;
position: relative;
overflow: hidden;
}
.img-zoom img {
-webkit-transform: scale(1.04);
-ms-transform: scale(1.04);
transform: scale(1.04);
transition: all 1.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.img-zoom img:hover {
-webkit-transform: scale(1.1);
-ms-transform: scale(1.1);
transform: scale(1.1);
}
.blogDesc {
background-color: whitesmoke;
width: 100%;
height: 40%;
}
.blogContent {
width: 200px;
height: 200px;
word-wrap: break-word;
border-radius:25px;
overflow: hidden;
display:inline-block;
margin:10px;
}
.blogTitle {
font-weight: bold;
font-family: "Courier New";
text-align: center;
padding: 10px;
}
.blogText {
-webkit-column-width: 150px;
column-width: 150px;
height: 100%;
margin-left: 10px;
margin-right: 10px;
}
.blogAlign{
text-align:center;
}
<section class="blogAlign">
<div class="blogContent">
<div class="img-zoom"><img src="https://kbob.github.io/images/sample-3.jpg" alt="" title=""></div>
<div class="blogDesc">
<div class="blogTitle">
My Multimedia Agency Tool
</div>
<div class="blogText">
BBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLABBBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLABBBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLABBBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLAB
</div>
</div>
</div>
<div class="blogContent">
<div class="img-zoom"><img src="https://kbob.github.io/images/sample-3.jpg" alt="" title=""></div>
<div class="blogDesc">
<div class="blogTitle">
My Multimedia Agency Tool
</div>
<div class="blogText">
BBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLABBBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLABBBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLABBBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLAB
</div>
</div>
</div>
<div class="blogContent">
<div class="img-zoom"><img src="https://kbob.github.io/images/sample-3.jpg" alt="" title="" class="picturez"></div>
<div class="blogDesc">
<div class="blogTitle">
My Multimedia Agency Tool
</div>
<div class="blogText">
BBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLABBBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLABBBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLABBBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLAB
</div>
</div>
</div>
</section>
Does anyone know how to fix this? Thanks in advance.
<div class="activity_rounded"><img src="http://placehold.it/100" /></div>
.activity_rounded {
display: inline-block;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
-khtml-border-radius: 50%;
border: 3px solid #fff;
}
.activity_rounded img {
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
-khtml-border-radius: 50%;
vertical-align: middle;
}
it should work properly.
Related
I already asked a similar question but it seems my code is not correct.
I used border in pixels and it is not responsive. I used bootsrtrap to make it responsive but then the hexagons are not as a grid (everyone next to the other)
Here is an image what should be done.
This is how it looks now
Here is my code, which probably is not the right one to allow me to achieve the image above. My hexagons are not as a grid (close to each others), are not scalable and are not responsive.
.hexagon {
position: relative;
width: 200px;
height: 115.47px;
background-color: #ffffff;
margin: 57.74px 0;
border-left: solid 2px #4850be;
border-right: solid 2px #4850be;
}
.hexagon:before,
.hexagon:after {
content: "";
position: absolute;
z-index: 1;
width: 141.42px;
height: 141.42px;
-webkit-transform: scaleY(0.5774) rotate(-45deg);
-ms-transform: scaleY(0.5774) rotate(-45deg);
transform: scaleY(0.5774) rotate(-45deg);
background-color: inherit;
left: 27.2893px;
z-index:1;
}
.hexagon:before {
top: -70.7107px;
border-top: solid 2.8284px #4850be;
border-right: solid 2.8284px #4850be;
}
.hexagon:after {
bottom: -70.7107px;
border-bottom: solid 2.8284px #4850be;
border-left: solid 2.8284px #4850be;
}
/* NEW */
.icon-box{
width: 70px;
height: 30px;
background-color: #4850be;
position: absolute;
top:-35px;
left: 0;
right: 0;
margin: auto;
z-index: 10;
}
.icon-box:before,
.icon-box:after{
content: "";
position: absolute;
z-index: 1;
width: 50px;
height: 50px;
-webkit-transform: scaleY(0.5774) rotate(-45deg);
-ms-transform: scaleY(0.5774) rotate(-45deg);
transform: scaleY(0.5774) rotate(-45deg);
background-color: inherit;
left: 0;
right: 0;
margin: auto;
background-color: #4850be;
z-index:1;
}
.icon-box:before {
top: -25px;
}
.icon-box:after {
bottom: -25px;
}
.icon-box i,
.icon-box img
{
position: absolute;
left: 0;
right: 0;
bottom: -20px;
margin: 0 auto;
z-index: 20;
font-size: 80px;
width: 60px;
height: 60px;
text-align: center;
color: #fff;
}
.text {
z-index: 10;
position: relative;
font-size: 7px;
text-align: center;
padding: 20px;
}
.text h3 {
font-size: 8px;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<section id="content">
<div class="container">
<div class="row">
<div class="col-3 col-6-medium col-12-small">
<div class="hexagon">
<div class="icon-box"><img src="images/section/section_2_icon_man.png" alt="" ></div>
<div class="text">
<h3>Head of Trust & Safety,Video Streaming Platform</h3>
<p>"ActiveFence is the foundation of our proactive moderation efforts. It's easy to show that there is no in-house equivalent we could ever develop. Even the best internal teams will never have ActiveFence's subject matter and linguistic expertise, and the cross platform visibility their technology provides is invaluable to keeping our users safe." </p>
</div>
</div>
</div>
<div class="col-3 col-6-medium col-12-small">
<div class="hexagon">
<div class="icon-box"><img src="images/section/section_2_icon_woman.png" alt="" ></div>
<div class="text">
<h3>Head of Trust & Safety,Video Streaming Platform</h3>
<p>"ActiveFence is the foundation of our proactive moderation efforts. It's easy to show that there is no in-house equivalent we could ever develop. Even the best internal teams will never have ActiveFence's subject matter and linguistic expertise, and the cross platform visibility their technology provides is invaluable to keeping our users safe." </p>
</div>
</div>
</div>
<div class="col-3 col-6-medium col-12-small">
<div class="hexagon">
<div class="icon-box"><i class="fa fa-user"></i></div>
<div class="text">
<h3>Head of Trust & Safety,Video Streaming Platform</h3>
<p>"ActiveFence is the foundation of our proactive moderation efforts. It's easy to show that there is no in-house equivalent we could ever develop. Even the best internal teams will never have ActiveFence's subject matter and linguistic expertise, and the cross platform visibility their technology provides is invaluable to keeping our users safe." </p>
</div>
</div>
</div>
</div>
</div>
</section>
Your webpage/website is not responsive because you used px, to make it responsive use Viewport Units like vw for width and vh for height instead of px and % to make your webpage/website responsive. (Note:- 1vw=0.5cm)
It will surely work but if it doesn't let me know in the comments, I will try my best to help you.
I managed to sort it out. Here is my different way:
#content-middle {
position: relative;
width: 100%;
min-height: 100vh;
margin: 0 auto;
overflow: hidden;
}
#content-middle::before {
top: 0;
height: 100%;
background: #f4f4f6;
-webkit-clip-path: polygon(0 46%, 0% 100%, 54% 100%);
clip-path: polygon(0 46%, 0% 100%, 54% 100%);
z-index: -1;
}
#content-middle::before, #content::after {
content: "";
position: absolute;
left: 0;
width: 100%;
}
.hexWrapper {
text-align: center;
margin: 0px;
position: relative;
display: inline-block;
width: 150px; /*Change this to resize*/
height: 150px; /*Change this to resize*/
min-width: 150px;
min-height: 150px;
float:left;
}
.hexagon {
height: calc(100%/1.732050807);
width: 100%;
background-color: #ffffff;
display:inline-block;
}
.hexagon:before,
.hexagon:after {
content: "";
position: absolute;
background-color: inherit;
height: inherit;
width: inherit;
left: -1px; right: -1px; top: 0; bottom: 0;
}
.hexagon:before {
transform: rotateZ(60deg);
}
.hexagon:after {
transform: rotateZ(120deg);
}
.hexagon,
.hexagon:before,
.hexagon:after {
box-sizing: content-box;
border: solid 2px #4850be;
border-top-width: 0;
border-bottom-width: 0;
z-index: -1; /*We need to force the z-index so we can put some text over*/
}
#container{
padding-top: 60px;
width:100%;
min-width:910px; /* so the page doesn't get too small. This should be done better with media queries*/
}
.row-hexagon{
clear:both; /*to reset all the configs*/
float:left;
display: flex; /* using some flex to aline to center */
justify-content: center;
overflow:hidden; /*this is for after, when we add more hex's*/
padding-top:145px; /* To take care of the top part of the hex, needs changing if we change the size on the wrapper*/
position:relative;
}
.fullWidth{
width: 100%;
}
.icon-box{
width: 75px;
height:40px;
background-color: #4850be;
position: absolute;
top:-25px;
left: 0;
right: 0;
margin: auto;
z-index: 10;
}
.icon-box:before,
.icon-box:after{
content: "";
position: absolute;
z-index: 1;
width: 50px;
height: 50px;
-webkit-transform: scaleY(0.5774) rotate(-45deg);
-ms-transform: scaleY(0.5774) rotate(-45deg);
transform: scaleY(0.5774) rotate(-45deg);
background-color: inherit;
left: 0;
right: 0;
margin: auto;
background-color: #4850be;
z-index:1;
}
.icon-box:before {
top: -25px;
}
.icon-box:after {
bottom: -25px;
}
.icon-box i,
.icon-box img {
position: absolute;
left: 0;
right: 0;
bottom: -20px;
margin: 0 auto;
z-index: 20;
font-size: 90px;
width: 80px;
height: 80px;
text-align: center;
color: #fff;
}
.text {
z-index: 10;
position: relative;
font-size: 17px;
text-align: center;
padding: 20px;
}
.text h3 {
font-size: 1em;
color:#42c9c0;
font-weight:700;
}
.text h4{
font-size: 0.8em;
color:#42c9c0;
font-weight:300;
}
.text p{
font-size: 0.5em;
font-weight:300;
font-style:italic;
}
<!-- <!-- FonT Awesome for demo purposes here --> -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<section id="content-middle">
<div id="container-hexagon">
<div class="row-hexagon fullWidth" id="firstRow">
<div class="hexWrapper">
<div class="hexagon">
<div class="icon-box"><i class="fa fa-user"></i></div>
<div class="text">
<h3>Title</h3>
<h4>Subtitle </h4>
<p>Text</p>
</div>
</div>
</div>
<div class="hexWrapper">
<div class="hexagon">
<div class="icon-box"><i class="fa fa-user"></i></div>
<div class="text">
<h3>Title</h3>
<h4>Subtitle </h4>
<p>Text</p>
</div>
</div>
</div>
<div class="hexWrapper">
<div class="hexagon">
<div class="icon-box"><i class="fa fa-user"></i></div>
<div class="text">
<h3>Title</h3>
<h4>Subtitle </h4>
<p>Text</p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
I am trying to achieve the image bellow:
I can do a hexagon border and text but I have no idea how to add the hexagon image and to do the grid of 3 hexagons.
Any help will be highly appreciate. If here is more elegant way using clip-path of SVG please help.
Here is my code:
HTML
<div class="container">
<div class="row">
<div class="col-3 col-6-medium col-12-small">
<div class="hexagon">
<div class="text">
<h3>Head of Trust & Safety,Video Streaming Platform</h3>
<p>"ActiveFence is the foundation of our proactive moderation efforts. It's easy to show that there is no in-house equivalent we could ever develop. Even the best internal teams will never have ActiveFence's subject matter and linguistic expertise, and the cross platform visibility their technology provides is invaluable to keeping our users safe." </p>
</div>
</div>
</div>
<div class="col-3 col-6-medium col-12-small">
<div class="hexagon">
<div class="text">
<h3>Head of Trust & Safety,Video Streaming Platform</h3>
<p>"ActiveFence is the foundation of our proactive moderation efforts. It's easy to show that there is no in-house equivalent we could ever develop. Even the best internal teams will never have ActiveFence's subject matter and linguistic expertise, and the cross platform visibility their technology provides is invaluable to keeping our users safe." </p>
</div>
</div>
</div>
<div class="col-3 col-6-medium col-12-small">
<div class="hexagon">
<div class="text">
<h3>Head of Trust & Safety,Video Streaming Platform</h3>
<p>"ActiveFence is the foundation of our proactive moderation efforts. It's easy to show that there is no in-house equivalent we could ever develop. Even the best internal teams will never have ActiveFence's subject matter and linguistic expertise, and the cross platform visibility their technology provides is invaluable to keeping our users safe." </p>
</div>
</div>
</div>
</div>
</div>
CSS
.hexagon {
position: relative;
width: 200px;
height: 115.47px;
background-color: #ffffff;
margin: 57.74px 0;
border-left: solid 2px #4850be;
border-right: solid 2px #4850be;
}
.hexagon:before,
.hexagon:after {
content: "";
position: absolute;
z-index: 1;
width: 141.42px;
height: 141.42px;
-webkit-transform: scaleY(0.5774) rotate(-45deg);
-ms-transform: scaleY(0.5774) rotate(-45deg);
transform: scaleY(0.5774) rotate(-45deg);
background-color: inherit;
left: 27.2893px;
}
.hexagon:before {
top: -70.7107px;
border-top: solid 2.8284px #4850be;
border-right: solid 2.8284px #4850be;
}
.hexagon:after {
bottom: -70.7107px;
border-bottom: solid 2.8284px #4850be;
border-left: solid 2.8284px #4850be;
}
So basically i have done it the same way, like u did before..
You could try a solution like this:
.hexagon {
position: relative;
width: 200px;
height: 115.47px;
background-color: #ffffff;
margin: 57.74px 0;
border-left: solid 2px #4850be;
border-right: solid 2px #4850be;
}
.hexagon:before,
.hexagon:after {
content: "";
position: absolute;
z-index: 1;
width: 141.42px;
height: 141.42px;
-webkit-transform: scaleY(0.5774) rotate(-45deg);
-ms-transform: scaleY(0.5774) rotate(-45deg);
transform: scaleY(0.5774) rotate(-45deg);
background-color: inherit;
left: 27.2893px;
/* NEW */
z-index:1;
}
.hexagon:before {
top: -70.7107px;
border-top: solid 2.8284px #4850be;
border-right: solid 2.8284px #4850be;
}
.hexagon:after {
bottom: -70.7107px;
border-bottom: solid 2.8284px #4850be;
border-left: solid 2.8284px #4850be;
}
/* NEW */
.icon-box {
width: 70px;
height: 30px;
background-color: orange;
position: absolute;
top:-35px;
left: 0;
right: 0;
margin: auto;
z-index: 10;
}
.icon-box:before,
.icon-box:after {
content: "";
position: absolute;
z-index: 1;
width: 50px;
height: 50px;
-webkit-transform: scaleY(0.5774) rotate(-45deg);
-ms-transform: scaleY(0.5774) rotate(-45deg);
transform: scaleY(0.5774) rotate(-45deg);
background-color: inherit;
left: 0;
right: 0;
margin: auto;
background-color: orange;
z-index:1;
}
.icon-box:before {
top: -25px;
}
.icon-box:after {
bottom: -25px;
}
.icon-box i {
position: absolute;
left: 0;
right: 0;
bottom: -15px;
margin: 0 auto;
z-index: 20;
font-size: 50px;
width: 40px;
height: 40px;
text-align: center;
color: #fff;
}
/* JUST FOR DEMO PURPOSE */
.text {
z-index: 10;
position: relative;
font-size: 7px;
text-align: center;
padding: 20px;
}
.text h3 {
font-size: 8px;
}
<!-- CSS only -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="container">
<div class="row">
<div class="col-3 col-6-medium col-12-small">
<div class="hexagon">
<div class="icon-box"><i class="fa fa-user"></i></div>
<div class="text">
<h3>Head of Trust & Safety,Video Streaming Platform</h3>
<p>"ActiveFence is the foundation of our proactive moderation efforts. It's easy to show that there is no in-house equivalent we could ever develop. Even the best internal teams will never have ActiveFence's subject matter and linguistic expertise, and the cross platform visibility their technology provides is invaluable to keeping our users safe." </p>
</div>
</div>
</div>
<div class="col-3 col-6-medium col-12-small">
<div class="hexagon">
<div class="icon-box"><i class="fa fa-user"></i></div>
<div class="text">
<h3>Head of Trust & Safety,Video Streaming Platform</h3>
<p>"ActiveFence is the foundation of our proactive moderation efforts. It's easy to show that there is no in-house equivalent we could ever develop. Even the best internal teams will never have ActiveFence's subject matter and linguistic expertise, and the cross platform visibility their technology provides is invaluable to keeping our users safe." </p>
</div>
</div>
</div>
<div class="col-3 col-6-medium col-12-small">
<div class="hexagon">
<div class="icon-box"><i class="fa fa-user"></i></div>
<div class="text">
<h3>Head of Trust & Safety,Video Streaming Platform</h3>
<p>"ActiveFence is the foundation of our proactive moderation efforts. It's easy to show that there is no in-house equivalent we could ever develop. Even the best internal teams will never have ActiveFence's subject matter and linguistic expertise, and the cross platform visibility their technology provides is invaluable to keeping our users safe." </p>
</div>
</div>
</div>
</div>
</div>
(i added bootstrap and fontawesome, for demonstration purpose..)
I managed to sort it out. Here is my different way:
#content-middle {
position: relative;
width: 100%;
min-height: 100vh;
margin: 0 auto;
overflow: hidden;
}
#content-middle::before {
top: 0;
height: 100%;
background: #f4f4f6;
-webkit-clip-path: polygon(0 46%, 0% 100%, 54% 100%);
clip-path: polygon(0 46%, 0% 100%, 54% 100%);
z-index: -1;
}
#content-middle::before, #content::after {
content: "";
position: absolute;
left: 0;
width: 100%;
}
.hexWrapper {
text-align: center;
margin: 0px;
position: relative;
display: inline-block;
width: 150px; /*Change this to resize*/
height: 150px; /*Change this to resize*/
min-width: 150px;
min-height: 150px;
float:left;
}
.hexagon {
height: calc(100%/1.732050807);
width: 100%;
background-color: #ffffff;
display:inline-block;
}
.hexagon:before,
.hexagon:after {
content: "";
position: absolute;
background-color: inherit;
height: inherit;
width: inherit;
left: -1px; right: -1px; top: 0; bottom: 0;
}
.hexagon:before {
transform: rotateZ(60deg);
}
.hexagon:after {
transform: rotateZ(120deg);
}
.hexagon,
.hexagon:before,
.hexagon:after {
box-sizing: content-box;
border: solid 2px #4850be;
border-top-width: 0;
border-bottom-width: 0;
z-index: -1; /*We need to force the z-index so we can put some text over*/
}
#container{
padding-top: 60px;
width:100%;
min-width:910px; /* so the page doesn't get too small. This should be done better with media queries*/
}
.row-hexagon{
clear:both; /*to reset all the configs*/
float:left;
display: flex; /* using some flex to aline to center */
justify-content: center;
overflow:hidden; /*this is for after, when we add more hex's*/
padding-top:145px; /* To take care of the top part of the hex, needs changing if we change the size on the wrapper*/
position:relative;
}
.fullWidth{
width: 100%;
}
.icon-box{
width: 75px;
height:40px;
background-color: #4850be;
position: absolute;
top:-25px;
left: 0;
right: 0;
margin: auto;
z-index: 10;
}
.icon-box:before,
.icon-box:after{
content: "";
position: absolute;
z-index: 1;
width: 50px;
height: 50px;
-webkit-transform: scaleY(0.5774) rotate(-45deg);
-ms-transform: scaleY(0.5774) rotate(-45deg);
transform: scaleY(0.5774) rotate(-45deg);
background-color: inherit;
left: 0;
right: 0;
margin: auto;
background-color: #4850be;
z-index:1;
}
.icon-box:before {
top: -25px;
}
.icon-box:after {
bottom: -25px;
}
.icon-box i,
.icon-box img {
position: absolute;
left: 0;
right: 0;
bottom: -20px;
margin: 0 auto;
z-index: 20;
font-size: 90px;
width: 80px;
height: 80px;
text-align: center;
color: #fff;
}
.text {
z-index: 10;
position: relative;
font-size: 17px;
text-align: center;
padding: 20px;
}
.text h3 {
font-size: 1em;
color:#42c9c0;
font-weight:700;
}
.text h4{
font-size: 0.8em;
color:#42c9c0;
font-weight:300;
}
.text p{
font-size: 0.5em;
font-weight:300;
font-style:italic;
}
<!-- FonT Awesome for demo purposes here -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<section id="content-middle">
<div id="container-hexagon">
<div class="row-hexagon fullWidth" id="firstRow">
<div class="hexWrapper">
<div class="hexagon">
<div class="icon-box"><i class="fa fa-user"></i></div>
<div class="text">
<h3>Title</h3>
<h4>Subtitle </h4>
<p>Text</p>
</div>
</div>
</div>
<div class="hexWrapper">
<div class="hexagon">
<div class="icon-box"><i class="fa fa-user"></i></div>
<div class="text">
<h3>Title</h3>
<h4>Subtitle </h4>
<p>Text</p>
</div>
</div>
</div>
<div class="hexWrapper">
<div class="hexagon">
<div class="icon-box"><i class="fa fa-user"></i></div>
<div class="text">
<h3>Title</h3>
<h4>Subtitle </h4>
<p>Text</p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
I am trying to clip this strap into the parent rectangle.
Image-
HTML CODE:
<div class="pricing_plan ultimate">
<div class="strap">
<P>RECOMMENDED</P>
</div>
<div class="p_name">
<p>Ultimate</p>
</div>
<div class="p_plan">
<p><strike>₹ 2388</strike></p>
<h3>₹ 1,099</h3>
<p>Save 53%</p>
</div>
<div class="p_duration">
<p>12 Months</p>
<p>356 Days</p>
</div>
<a href="">
<button class="pricing_button ultimate">BUY</button>
</a>
</div>
CSS
.s2 .pricing_plans .ultimate .strap{
position: relative;
top: -13px;
right: 65px;
transform: rotate(-35deg);
clip-path: inset(0px 50px 50px 0px);
}
.s2 .pricing_plans .ultimate .strap p{
background-color: white;
font-size: 10px;
color: #3499E0;
padding-left: 20px;
padding-right: 20px;
margin-top: 0px;
margin-bottom: 0px;
}
How can I clip it into the rectangle so that it doesn't flow outside.
I have tried overflow: hidden it doesn't seem to work.
What is the best method to it, so that it is best for a responsive design?
You have to use position:relative with the parent bloc, and position:absolute with the child bloc :
.bloc{
background: red;
position: relative;
overflow: hidden;
width: 200px;
height: 300px;
}
.bloc .label{
position: absolute;
top: 15px;
left: -20px;
width: 120px;
height: 20px;
background: black;
color: #fff;
text-align: center;
transform: rotate(-35deg);
}
<div class="bloc">
<div class="label">
Label here
</div>
</div>
I have an image gallery with some hover affects that I want to refine. When the user hovers on an image, the other pictures in the gallery get dimmed out. But I also want some text to slide in from the left on hover as well. Something like this website has http://gugroppo.com/projects.
I have the text appear on hover but I can't get it to transition in from the left smoothly; or have my overlay effect appear smoothly as well. Everything just appears. Here's my codepen.
window.sr = ScrollReveal({reset: true});
sr.reveal('img', {mobile:true});
body {
margin: 0;
padding: 0;
}
h2 {
padding-bottom: 7.5%;
color: #7bbe9a;
text-align: center;
font-size: 1.875em;
font-family: 'Lato', sans-serif;
}
.gallery{
width: 100%;
display: inline-block;
flex-wrap: wrap;
justify-content: center;
padding-top: 7.5%;
padding-bottom: 15%;
background-color: #333;
}
.img-container {
-webkit-transition: opacity 0.3s;
-moz-transition: opacity 0.3s;
-ms-transition: opacity 0.3s;
-o-transition: opacity 0.3s;
transition: opacity 0.3s;
width: 33.33%;
float: left;
display: block;
position: relative;
}
.img-container img{
display: block;
width: 100%;
height: auto;
}
#slide {
position: absolute;
left: -100px;
transition: 1s;
width: 100%;
height: 100%;
}
.overlay {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
right: 0;
bottom: 0;
opacity: 0;
/* background: rgba(123, 190, 154, 0.72); */
background: rgba(51,51,51, 0.2);
}
.text {
color: white;
position: absolute;
top: 50%;
left: 50%;
font-size: 24px;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
text-align: center;
font-family: 'Lato', sans-serif;
}
#parent:hover > .img-container:not(:hover) {
opacity: 0.3;
}
.img-container:hover .overlay {
opacity: 1;
}
#media(max-width:768px){
.img-container {
width: 100% !important;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://unpkg.com/scrollreveal/dist/scrollreveal.min.js"></script>
<body>
<a class="anchor" name="portfolio">
<div class="gallery">
<h2>Portfolio</h2>
</a>
<div id="parent">
<div class="img-container">
<a href="">
<img src="https://img1.cgtrader.com/items/4716/33d9798412/large/wicker-laundry-basket-3d-model-obj-3ds-c4d.jpg" alt=""></a>
<div class="overlay">
<div class="text">Basket</div>
</div>
</div>
<div class="img-container">
<a href="">
<img src="https://cdn.shopify.com/s/files/1/0225/1115/products/buildings-rts-orc-smithy-low-poly-3d-model-2_400x.jpeg?v=1456744435" alt=""></a>
<div class="overlay">
<div class="text">Train</div>
</div>
</div>
<div class="img-container">
<a href="">
<img src="http://www.pycomall.com/images/P1/Bed_Room_Interior_3D_Model_in_Max_format_7.jpg" alt=""></a>
<div class="overlay">
<div class="text">Bed</div>
</div>
</div>
<div class="img-container">
<a href="">
<img src="http://mycreativedaddy.com/wp-content/uploads/chair-capitone-3d-model.jpg" alt=""></a>
<div class="overlay">
<div class="text">Chair</div>
</div>
</div>
<div class="img-container">
<a href="">
<img src="http://www.pycomall.com/images/P1/Restaurant_Interior_3D_Model_in_Max_format_4.jpg" alt=""></a>
<div class="overlay">
<div class="text">Room</div>
</div>
</div>
<div class="img-container">
<a href="">
<img src="https://3dexport.com/items/2008/07/29/11820/9454/wedding_ring._3d_model_c4d_max_obj_fbx_ma_lwo_3ds_3dm_stl_66996.jpg" alt=""></a>
<div class="overlay">
<div class="text">Ring</div>
</div>
</div>
<div class="img-container">
<a href="">
<img src="http://www.madsonline.net/wp-content/uploads/2017/07/living-room-interior-3d-model-in-max-format-3-3d-models-in-3d-living-room-model.jpg" alt=""></a>
<div class="overlay">
<div class="text">Couch</div>
</div>
</div>
<div class="img-container">
<a href="">
<img src="https://d1a9v60rjx2a4v.cloudfront.net/2013/10/03/00_54_27_730_00_1.jpg" alt=""></a>
<div class="overlay">
<div class="text">Glass</div>
</div>
</div>
<div class="img-container">
<a href="">
<img src="https://img1.cgtrader.com/items/5185/bb5b9f2fde/large/bailarina-3d-model-obj-3ds-fbx-ma-mb.jpg" alt=""></a>
</div>
</div>
</body>
What you want to do is add overflow: hidden to your container
.img-container{overflow: hidden;}
Then initially start the text off the element. I did this by setting
.text{left: -50%;}
Finally you need to call the text back into the element on hover by using container:hover and setting the text back to 50%;
.img-container:hover .text{left: 50%;}
Lastly you will just need to add in some transition properties and attributes of your likely. Hope this helps.
The follow CSS should accomplish what you are looking for
body {
margin: 0;
padding: 0;
}
h2 {
padding-bottom: 7.5%;
color: #7bbe9a;
text-align: center;
font-size: 1.875em;
font-family: 'Lato', sans-serif;
}
.gallery{
width: 100%;
display: inline-block;
flex-wrap: wrap;
justify-content: center;
padding-top: 7.5%;
padding-bottom: 15%;
background-color: #333;
}
.img-container {
-webkit-transition: opacity 0.3s;
-moz-transition: opacity 0.3s;
-ms-transition: opacity 0.3s;
-o-transition: opacity 0.3s;
transition: opacity 0.3s;
width: 33.33%;
float: left;
display: block;
position: relative;
overflow: hidden;
}
.img-container img{
display: block;
width: 100%;
height: auto;
}
#slide {
position: absolute;
left: -100px;
transition: 1s;
width: 100%;
height: 100%;
}
.overlay {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
right: 0;
bottom: 0;
opacity: 0;
/* background: rgba(123, 190, 154, 0.72); */
background: rgba(51,51,51, 0.2);
}
.text {
color: white;
position: absolute;
top: 50%;
left: -50%;
font-size: 24px;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
text-align: center;
font-family: 'Lato', sans-serif;
}
.img-container:hover .text {
left: 50%;
}
#parent:hover > .img-container:not(:hover) {
opacity: 0.3;
}
.img-container:hover .overlay {
opacity: 1;
}
#media(max-width:768px){
.img-container {
width: 100% !important;
}
}
I want these images above to pop up when someone hovers over them, each image pops up and comes to the center when someone hovers a mouse over the image, also they should be arranged in that format. I want to do this in WordPress, I am designing a website and the client wants that effect. Is it possible friends? please someone assist me.
HTML code
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<nav>
<img src="http://winn-brown.co.uk/wp-content/uploads/2016/06/Logo-new.png" id="logo">
</nav>
<div class="wrapper">
<div class="parent" onclick="">
<div class="child bg-one">
Los Angeles
</div>
</div>
<div class="parent right" onclick="">
<div class="child bg-two">
London
</div>
</div>
<div class="parent" onclick="">
<div class="child bg-three">
New York
</div>
</div>
<div class="parent right" onclick="">
<div class="child bg-four">
Hollywood
</div>
</div>
<div class="parent" onclick="">
<div class="child bg-five">
Dubai
</div>
</div>
<div class="parent right" onclick="">
<div class="child bg-six">
San Francisco
</div>
</div>
</div>
CSS Code
/* Global Styling */
html, body {margin:0px; padding: 0px;}
nav {
background-color: #34495e;
height: 80px;
position: fixed;
width: 100vw;
top: 0;
z-index: 999;
}
#logo {height: 80px; margin-left: 20px;}
.wrapper {
padding: 50px 50px;
max-width: 1200px;
text-align: center;
margin-left: auto;
margin-right: auto;
margin-top: 80px;
}
.right {float: right !important;}
/* Image zoom on hover + Overlay colour */
.parent {
width: 45%;
margin: 20px;
height: 300px;
border: 1px solid blue;
overflow: hidden;
position: relative;
float: left;
display: inline-block;
cursor: pointer;
}
.child {
height: 100%;
width: 100%;
background-size: cover;
background-repeat: no-repeat;
-webkit-transition: all .5s;
-moz-transition: all .5s;
-o-transition: all .5s;
transition: all .5s;
}
/* Several different images */
.bg-one {background-image: url(https://media.timeout.com/images/101602611/image.jpg);}
.bg-two {background-image: url(http://s1.it.atcdn.net/wp-content/uploads/2015/08/2-London.jpg);}
.bg-three {background-image: url(https://media.timeout.com/images/101484105/image.jpg);}
.bg-four {background-image: url(https://upload.wikimedia.org/wikipedia/commons/thumb/0/00/Hollywood_Sign.jpg/1280px-Hollywood_Sign.jpg);}
.bg-five {background-image: url(http://www.travelandleisure.com/sites/default/files/styles/tnl_redesign_article_landing_page/public/1453920892/DUBAI-554088081-ABOVE0116.jpg?itok=dcoZnCrc);}
.bg-six {background-image: url(http://blog.whitepages.com/wp-content/uploads/2015/04/san-franc.jpg);}
a {
display: none;
font-size: 35px;
color: #ffffff !important;
font-family: sans-serif;
text-align: center;
margin: auto;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
height: 50px;
cursor: pointer;
/*text-decoration: none;*/
}
.parent:hover .child, .parent:focus .child {
-ms-transform: scale(1.2);
-moz-transform: scale(1.2);
-webkit-transform: scale(1.2);
-o-transform: scale(1.2);
transform: scale(1.2);
}
.parent:hover .child:before, .parent:focus .child:before {
display: block;
}
.parent:hover a, .parent:focus a {
display: block;
}
.child:before {
content: "";
display: none;
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
background-color: rgba(52,73,94,0.75);
}
/* Media Queries */
#media screen and (max-width: 960px) {
.parent {width: 100%; margin: 20px 0px}
.wrapper {padding: 20px 20px;}
}
.hello {display: none}
You will try this using that code when you hover the image then it will be zoom out the image. I think it will help you.