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>
Related
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 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.
I have placed several paragraphs into div element but text are appearing at the bottom of block. What might be the problem? As well would be great if you can suggest how to make the blocks more responsive.
HTML:
<div class="container">
<div class="content">
<div class="inner">
<h1><span>What</span> Clients Says</h1>
<div class="main-block">
<div class="testimonial-block-1">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTLdI6QE_lvzsCy_6VTsikYLz0iPFnWSv2vbGVzbwgQA8OlEbpH" alt="">
<p>- Staciya Trollio</p>
<p>Customer</p>
<p>Lorem Ipsum is simply dummy text of the printing
and industry. Lorem Ipsum has been the industry.</p>
</div>
<div class="testimonial-block-2">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTLdI6QE_lvzsCy_6VTsikYLz0iPFnWSv2vbGVzbwgQA8OlEbpH">
<p>- David Soul</p>
<p>Customer</p>
<p>Lorem Ipsum is simply dummy text of the printing
and industry. Lorem Ipsum has been the industry.</p>
</div>
</div>
</div>
</div>
</div>
CSS:
* {
padding: 0;
margin: 0;
box-sizing:border-box;
}
html, body {
height: 100%;
}
.container {
height: 100%;
background: url(bg.jpg);
min-width: 100%;
background-size: 100%;
font-family: sans-serif;
}
.content {
position:absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(16,21,26,.9);
width: 100%;
}
.inner {
position: absolute;
left: 50%;
top: 40%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.inner h1 {
color: #3170a8;
text-align: center;
}
.inner h1 span {
color: #ee8129;
}
.main-block {
margin-top: 50px;
}
.testimonial-block-1 {
float: left;
max-width: 364px;
background-color: #fff;
min-height: 100px;
margin-right: 45px;
position:relative;
z-index:100;
}
.testimonial-block-1::after,
.testimonial-block-2::after {
position: absolute;
top: 25%;
left: -20px;
content: '';
width: 0;
height: 0;
border-right: solid 20px rgb(255,255,255);
border-bottom: solid 20px transparent;
border-top: solid 20px transparent;
z-index:2;
}
.testimonial-block-1 img {
position:relative;
right:150px;
}
.testimonial-block-2 img,
.testimonial-block-1 img{
position:relative;
right:150px;
max-width: 107px;
height: 106px;
}
.testimonial-block-2 {
float: right;
max-width: 364px;
background-color: #fff;
min-height: 100px;
position:relative;
left:160px;
z-index:100;
}
.testimonial-block-1 p:nth-child(3),
.testimonial-block-2 p:nth-child(3) {
border-bottom:1px dashed #222;
}
Jsfiddle
Use this for the images, otherwise (if you use position: relative , regardless of the settings) the space they usually occupy will remain reserved for them (i.e. empty) in the container:
position:absolute;
left: -150px;
and create a margin-bottom below the testemonial-blocks:
* {
padding: 0;
margin: 0;
box-sizing:border-box;
}
html, body {
height: 100%;
}
.container {
height: 100%;
background: url(bg.jpg);
min-width: 100%;
background-size: 100%;
font-family: sans-serif;
}
.content {
position:absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(16,21,26,.9);
width: 100%;
}
.inner {
position: absolute;
left: 50%;
top: 40%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.inner h1 {
color: #3170a8;
text-align: center;
}
.inner h1 span {
color: #ee8129;
}
.main-block {
margin-top: 50px;
}
.testimonial-block-1 {
float: left;
max-width: 364px;
background-color: #fff;
min-height: 100px;
margin-right: 45px;
position:relative;
z-index:100;
}
.testimonial-block-1,
.testimonial-block-2 {
margin-bottom: 30px;
}
.testimonial-block-1::after,
.testimonial-block-2::after {
position: absolute;
top: 25%;
left: -20px;
content: '';
width: 0;
height: 0;
border-right: solid 20px rgb(255,255,255);
border-bottom: solid 20px transparent;
border-top: solid 20px transparent;
z-index:2;
}
.testimonial-block-2 img,
.testimonial-block-1 img{
position:absolute;
left: -150px;
max-width: 107px;
height: 106px;
}
.testimonial-block-2 {
float: right;
max-width: 364px;
background-color: #fff;
min-height: 100px;
position:relative;
left:160px;
z-index:100;
}
.testimonial-block-1 p:nth-child(3),
.testimonial-block-2 p:nth-child(3) {
border-bottom:1px dashed #222;
}
<div class="container">
<div class="content">
<div class="inner">
<h1><span>What</span> Clients Says</h1>
<div class="main-block">
<div class="testimonial-block-1">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTLdI6QE_lvzsCy_6VTsikYLz0iPFnWSv2vbGVzbwgQA8OlEbpH" alt="">
<p>- Staciya Trollio</p>
<p>Customer</p>
<p>Lorem Ipsum is simply dummy text of the printing
and industry. Lorem Ipsum has been the industry.</p>
</div>
<div class="testimonial-block-2">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTLdI6QE_lvzsCy_6VTsikYLz0iPFnWSv2vbGVzbwgQA8OlEbpH">
<p>- David Soul</p>
<p>Customer</p>
<p>Lorem Ipsum is simply dummy text of the printing
and industry. Lorem Ipsum has been the industry.</p>
</div>
</div>
</div>
</div>
</div>
Try this:
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html,
body {
height: 100%;
}
.container {
height: 100%;
background: url(bg.jpg);
min-width: 100%;
background-size: 100%;
font-family: sans-serif;
}
.content {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(16, 21, 26, .9);
width: 100%;
}
.inner {
position: absolute;
left: 50%;
top: 40%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.inner h1 {
color: #3170a8;
text-align: center;
}
.inner h1 span {
color: #ee8129;
}
.main-block {
margin-top: 50px;
}
.testimonial-block-1 {
float: left;
max-width: 364px;
background-color: #fff;
min-height: 100px;
margin-right: 45px;
position: relative;
z-index: 100;
}
.testimonial-block-1::after,
.testimonial-block-2::after {
position: absolute;
top: 25%;
left: -20px;
content: '';
width: 0;
height: 0;
border-right: solid 20px rgb(255, 255, 255);
border-bottom: solid 20px transparent;
border-top: solid 20px transparent;
z-index: 2;
}
.testimonial-block-1 img {
position: relative;
right: 150px;
}
.testimonial-block-2 img,
.testimonial-block-1 img {
position: absolute;
left: -150px;
max-width: 107px;
height: 106px;
}
.testimonial-block-2 {
float: right;
max-width: 364px;
background-color: #fff;
min-height: 100px;
position: relative;
left: 160px;
z-index: 100;
}
.testimonial-block-1 p:nth-child(3),
.testimonial-block-2 p:nth-child(3) {
border-bottom: 1px dashed #222;
}
<div class="container">
<div class="content">
<div class="inner">
<h1><span>What</span> Clients Says</h1>
<div class="main-block">
<div class="testimonial-block-1">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTLdI6QE_lvzsCy_6VTsikYLz0iPFnWSv2vbGVzbwgQA8OlEbpH" alt="">
<p>- Staciya Trollio</p>
<p>Customer</p>
<p>Lorem Ipsum is simply dummy text of the printing and industry. Lorem Ipsum has been the industry.</p>
</div>
<div class="testimonial-block-2">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTLdI6QE_lvzsCy_6VTsikYLz0iPFnWSv2vbGVzbwgQA8OlEbpH">
<p>- David Soul</p>
<p>Customer</p>
<p>Lorem Ipsum is simply dummy text of the printing and industry. Lorem Ipsum has been the industry.</p>
</div>
</div>
</div>
</div>
</div>
I've changed the position: relative to position: absolute and added a negative left: -150px and removed the right: 150px.
i think this will do the trick, i used display:flex to set everything in the right place i also removed a few of the position:absolute. i believe this will save you a lot of unnecessary code and positioning and will make your code much cleaner.
https://jsfiddle.net/Lsjo988z/3/
html:
<div class="container">
<div class="content">
<div class="inner">
<h1><span>What</span> Clients Says</h1>
<div class="main-block">
<div class="chat-container align-start" >
<div class="row">
<div>
<img class="img" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTLdI6QE_lvzsCy_6VTsikYLz0iPFnWSv2vbGVzbwgQA8OlEbpH" alt="">
</div>
<div class="testimonial-block">
<p>- Staciya Trollio</p>
<p>Customer</p>
<p>Lorem Ipsum is simply dummy text of the printing
and industry. Lorem Ipsum has been the industry.</p>
</div>
</div>
</div>
<div class="chat-container align-center" >
<div class="row">
<div>
<img class="img" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTLdI6QE_lvzsCy_6VTsikYLz0iPFnWSv2vbGVzbwgQA8OlEbpH">
</div>
<div class="testimonial-block">
<p>- David Soul</p>
<p>Customer</p>
<p>Lorem Ipsum is simply dummy text of the printing
and industry. Lorem Ipsum has been the industry.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
css:
* {
padding: 0;
margin: 0;
box-sizing:border-box;
}
html, body {
height: 100%;
}
.container {
height: 100%;
background: url(bg.jpg);
min-width: 100%;
background-size: 100%;
font-family: sans-serif;
}
.content {
width: 100%;
height: 100%;
background-color: rgba(16,21,26,.9);
}
.inner {
width: 100%;
}
.inner h1 {
color: #3170a8;
text-align: center;
}
.inner h1 span {
color: #ee8129;
}
.main-block {
margin-top: 50px;
}
.chat-container{
display:flex;
flex-wrap:wrap
}
.row{
display:flex;
-webkit-box-orient: horizontal;
-webkit-flex-direction: row;
flex-direction: row;
}
.align-start{
justify-content: flex-start;
}
.align-center{
justify-content: center;
}
.img{
max-width: 107px;
height: 106px;
}
.testimonial-block {
width:290px;
margin-left:43px;
//float: left;
max-width: 364px;
background-color: #fff;
min-height: 100px;
//margin-right: 45px;
position:relative;
z-index:100;
}
.testimonial-block::after {
position: absolute;
top: 25%;
left: -20px;
content: '';
width: 0;
height: 0;
border-right: solid 20px rgb(255,255,255);
border-bottom: solid 20px transparent;
border-top: solid 20px transparent;
z-index:2;
}
.testimonial-block-1 img {
position:relative;
right:150px;
}
.testimonial-block p:nth-child(3) {
border-bottom:1px dashed #222;
}
for more information about display flex abilities you can read this really good explanation https://css-tricks.com/snippets/css/a-guide-to-flexbox/
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.