im using a flip box with a front and back content when i hover (rotateY(180deg)) . that worked for simple container (only text) but didn't work when the background was an image this is my first time using nth-child element so any advises are welcome^^.
(its a small screen version for now)
and thanks in advance.
/*
===============
SERVICES
===============
*/
.title-service {
margin-top: 100px;
text-align: center;
}
.title-service p {
margin-top: -30px;
}
.container-service {
width: 70vh;
height: 50vh;
margin-left: 30px;
background: grey;
margin-bottom: 10px;
align-items: center;
text-align: center;
padding-top: 25%;
transform-style: preserve-3d;
transition: 0.3s ease all;
}
.container-service:hover {
transform: rotateY(180deg);
}
.front-card {
backface-visibility: hidden;
position: absolute;
height: 100%;
width: 100%;
top: 0;
left: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
}
.back-card {
backface-visibility: hidden;
position: absolute;
height: 100%;
width: 100%;
top: 0;
left: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
transform: rotateY(180deg);
}
.container-service h3 {
color: black;
font-size: 26px;
font-weight: 700;
}
.container-service i {
font-size: 40px;
color: black;
}
.container-service:nth-child(3) {
background-image: url(../Responsive\ Website/img-2.jpg);
background-size: cover;
position: relative;
}
.container-service:nth-child(3) .front-card::after {
content: "";
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
z-index: -1;
}
.dev h3 {
color: whitesmoke;
}
.dev i {
color: whitesmoke;
}
<!-- START SERVICES -->
<section class="service">
<div class="info-service">
<div class="title-service">
<h1>SERVICES</h1>
<p>Lorem ipsum dolor, sit amet consectetur adipisicing elit.</p>
</div>
<div class="container-service web">
<div class="front-card">
<span><i class="fas fa-palette"></i></span>
<h3>Web Design</h3>
</div>
<div class="back-card">
<p>
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Libero
maxime, reiciendis, ut earum amet architecto, cum magni cumque eum
repudiandae a minus sunt! Sed porro expedita, fuga aspernatur
molestiae iste ab cupiditate repudiandae cumque officia ea.
Tenetur amet ullam voluptatum?
</p>
</div>
</div>
<div class="container-service f-e">
<div class="dev">
<div class="front-card">
<span><i class="fas fa-laptop-code"></i></span>
<h3>Front Dev</h3>
</div>
<div class="back-card">
<h3>Front Dev</h3>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugit
optio, eum esse doloremque molestias aspernatur.
</p>
</div>
</div>
</div>
<div class="container-service branding">
<div class="front-card">
<span><i class="fas fa-building"></i></span>
<h3>Branding</h3>
</div>
<div class="back-card">
<h3>Branding</h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Consequuntur, error.
</p>
</div>
</div>
</div>
</section>
<!-- END SERVICES -->
The front and back are stacked above the parent wrapper and have inherited the parent background color, try applying the image to the front card of the third child.
Related
I am using vue-slick-carousel package.
I have three main elements with which I want to interact. The first one is a picture with a character with the class slide__person The second one is a text with the class slide__text and a picture with a cloud with the class banner__slider-cloud.
I need the text to overlap the cloud, and the cloud, in turn, overlaps the picture with the person.
The cloud must remain static and cannot be moved inside the slider
I want to achieve something like this.
.banner__slider-cloud {
z-index: 1;
}
.slide__text {
z-index: 2;
}
.slide__person {
z-index: 0;
}
I tried different options, interacted with the z-index property, tried to apply the position property, but I could not solve this problem
You can also see my code in the online sandbox codesandbox
<script>
import VueSlickCarousel from "vue-slick-carousel";
import "vue-slick-carousel/dist/vue-slick-carousel.css";
// optional style for arrows & dots
import "vue-slick-carousel/dist/vue-slick-carousel-theme.css";
export default {
name: "HelloWorld",
components: { VueSlickCarousel },
};
</script>
<template>
<div class="lending">
<main class="banner">
<div class="banner__slider">
<VueSlickCarousel :arrows="true" :dots="true">
<div class="slide">
<div>
<img
class="slide__person"
src="https://www.wikihow.com/images/6/61/Draw-a-Cartoon-Man-Step-15.jpg"
/>
<p class="slide__text">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Aliquam architecto, corporis deserunt distinctio dolor dolores
ea ex hic iste magnam nihil optio perferendis perspiciatis
</p>
</div>
</div>
<div class="slide">
<div>
<img
class="slide__person"
src="https://www.wikihow.com/images/6/61/Draw-a-Cartoon-Man-Step-15.jpg"
/>
<p class="slide__text">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Aliquam architecto, corporis deserunt distinctio dolor dolores
ea ex hic iste magnam nihil optio perferendis perspiciatis
</p>
</div>
</div>
</VueSlickCarousel>
<img class="banner__slider-cloud" src="../assets/cloud.png" />
</div>
</main>
</div>
</template>
<style>
img {
max-width: 100%;
}
.slick-slide > div {
display: flex;
justify-content: center;
}
.slide {
max-width: 500px;
border: 2px solid orange;
padding: 1rem;
}
.slide .slide__text {
border: 2px solid green;
padding: 8px;
}
.banner__slider-cloud {
border: 1px solid;
max-width: 960px;
margin: auto;
position: absolute;
right: 0;
left: 0;
top: 5%;
}
</style>
img {
max-width: 100%;
}
.slick-slide>div {
display: flex;
justify-content: center;
}
.slide {
max-width: 500px;
border: 2px solid orange;
padding: 1rem;
}
.slide .slide__text {
border: 2px solid green;
padding: 8px;
}
.banner__slider-cloud {
border: 1px solid;
max-width: 960px;
margin: auto;
position: absolute;
right: 0;
left: 0;
top: 5%;
}
<div class="lending">
<main class="banner">
<div class="banner__slider">
<div class="slide">
<div>
<img class="slide__person" src="https://www.wikihow.com/images/6/61/Draw-a-Cartoon-Man-Step-15.jpg" />
<p class="slide__text">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquam architecto, corporis deserunt distinctio dolor dolores ea ex hic iste magnam nihil optio perferendis perspiciatis
</p>
</div>
</div>
<img class="banner__slider-cloud" src="https://via.placeholder.com/500" />
</div>
</main>
</div>
z-index only works on elements within the same stacking context
By moving the cloud image element to be a sibling of the text and person image elements, their z-indexes will cause them to overlap the way you want
<div>
<img
class="slide__person"
src="https://www.wikihow.com/images/6/61/Draw-a-Cartoon-Man-Step-15.jpg"
/>
<p class="slide__text">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Aliquam architecto, corporis deserunt distinctio dolor dolores
ea ex hic iste magnam nihil optio perferendis perspiciatis
</p>
<img class="banner__slider-cloud" src="../assets/cloud.png" />
</div>
.slide .slide__person {
position: relative;
z-index: 0;
}
.slide .slide__text {
border: 2px solid green;
padding: 8px;
position: relative;
z-index: 2;
}
.banner__slider-cloud {
border: 1px solid;
max-width: 960px;
margin: auto;
position: absolute;
left: 17%;
top: 5%;
z-index: 1;
}
updated codesandbox
Although I believe a full solution is impossible, due to the DOM manipulation that the Vue Slick Carousel library uses, there is a workaround to the z-index limitation using transform-style: preserve-3d.
So long as all the elements in the DOM hierarchy being manipulated have the preserve-3d CSS attribute applied (this property is not automatically inherited), you can use transform: translateZ() to sort elements' layering even when they are not siblings in the stacking context. See the edited snippet below.
img {
max-width: 100%;
}
/* ### Added this block ### */
.banner * {
transform-style: preserve-3d;
}
.slick-slide>div {
display: flex;
justify-content: center;
}
.slide {
max-width: 500px;
border: 2px solid orange;
padding: 1rem;
}
.slide .slide__text {
border: 2px solid green;
padding: 8px;
transform: translateZ(1px); /* ### Added this line ### */
}
.banner__slider-cloud {
border: 1px solid;
max-width: 960px;
margin: auto;
position: absolute;
right: 0;
left: 0;
top: 5%;
}
<div class="lending">
<main class="banner">
<div class="banner__slider">
<div class="slide">
<div>
<img class="slide__person" src="https://www.wikihow.com/images/6/61/Draw-a-Cartoon-Man-Step-15.jpg" />
<p class="slide__text">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquam architecto, corporis deserunt distinctio dolor dolores ea ex hic iste magnam nihil optio perferendis perspiciatis
</p>
</div>
</div>
<img class="banner__slider-cloud" src="https://via.placeholder.com/500" />
</div>
</main>
</div>
I am seeking to make a drivers' page. In the desktop view, I would like my images to be next to each other horizontally. Right now, they are vertically aligned.
I have tried changing the display attribute, but it didn't turn out great. The closed thing I have done using the grid display.
I am still fairly new to this. So any help rendered will be appreciated. Thanks!
Here is what my code looks like;
Html Code:
<div class="drivers-container">
<div class="driver-row">
<!--Drivers from Spain-->
<h2><a id="spain" href="#spain">Spain</a></h2>
<div class="image2">
<img src="Drivers/EFREN LLARENA (Spain) 2.jpg" alt="Efren Llarena" width="500">
<div class="details">
<h2><span>Efren Llarena</span></h2>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Nesciunt explicabo perferendis mollitia iste libero magni ab! Ipsam id beatae nesciunt?.</p>
</div>
</div>
<div class="image2">
<img src="Drivers/Sara Fernandez (Spain).jpg" alt="Sara Fernandez" width="500" height="400">
<div class="details">
<h2><span>Sara Fernandez</span></h2>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Nesciunt explicabo perferendis mollitia iste libero magni ab! Ipsam id beatae nesciunt?.</p>
</div>
</div>
</div>
Sara Fernandez (Spain)
Efren-Llarena (Spain)
CSS Code;
.driver-row h2 a{
color: #fff;
text-decoration: none;
font-size: 70px;
font-weight: 300;
}
.drivers-container{
margin: 30px;
}
.driver-row{
width: 100%;
display: grid;
justify-content: center;
flex-wrap: wrap;
}
.image2{
background: #000000;
position: relative;
flex: 1;
max-width: 460px;
height: 300px;
margin: 20px;
overflow: hidden;
}
.image2 img{
opacity: 0.8;
position: relative;
vertical-align: top;
transition: 0.6s;
transition-property: opacity;
}
.image2:hover img{
opacity: 1;
}
.image2 .details{
z-index: 1;
position: absolute;
top: 0;
right: 0;
color: rgb(0, 0, 0);
width: 100%;
height: 100%;
}
.image2 .details h2{
text-align: center;
font-size: 35px;
text-transform: uppercase;
font-weight: 300;
margin-top: 70px;
transition: 0.4s;
transition-property: transform;
}
.image2 .details h2 span{
font-weight: 900;
}
.image2:hover .details h2{
transform: translateY(-30px);
}
.image2 .details p{
margin: 30px 30px 0 30px;
font-size: 18px;
font-weight: 600;
text-align: center;
opacity: 0;
transition: 0.6s;
transition-property: opacity,transform;
}
.image2:hover .details p{
opacity: 1;
transform: translateY(-40px);
}
i recommend you to extract heading and extra stuff from the driver-container
<div class="drivers-container">
<h2>
<a id="spain" href="#spain">Spain</a>
</h2>
<div class="driver-row">
<div class="image2">
<img src="Drivers/EFREN LLARENA (Spain) 2.jpg" alt="Efren Llarena" width="500">
<div class="details">
<h2><span>Efren Llarena</span></h2>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Nesciunt explicabo perferendis mollitia iste libero magni ab! Ipsam id beatae nesciunt?.</p>
</div>
</div>
<div class="image2">
<img src="Drivers/Sara Fernandez (Spain).jpg" alt="Sara Fernandez" width="500" height="400">
<div class="details">
<h2><span>Sara Fernandez</span></h2>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Nesciunt explicabo perferendis mollitia iste libero magni ab! Ipsam id beatae nesciunt?.</p>
</div>
</div>
</div>
now for your css I'll only write down necessary rules, add your own designs later
.driver-row{
display: flex;
flex-wrap: wrap;
width: 100%;
}
.image2{
width: 50%;
box-sizing: border-box;
padding: 20px;
position: relative ;
}
.image2 img{
width:100%;
height: 400px;
object-fit: cover;
}
.image2. details{
position: absolute ;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
it is using flexbox only.
I'm trying to make a component that uses both a background color for half of the component and
an image for the other half, with the image acting as an element with a margin. The problem I'm having is that I cannot use display flex to space elements correctly in the content area, it breaks the component with the current solution I'm using and I have no idea why.
I'm specifically trying to position .service__link at the bottom of .service__content. I've tried using paddings/margins to get it in place, but at smaller screen sizes it ends up overflowing out of the box.
*, *::before, *::after {
box-sizing: border-box;
}
* {
padding: 0;
margin: 0;
}
body {
min-height: 100vh;
font-family: Arial;
}
.service-container {
max-width: 1800px;
margin-inline: auto;
padding: 40px 15px;
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 1.5rem;
}
.service {
flex: 1 1 calc(33.3336% - 1.5rem);
display: inline-block;
position: relative;
background: #144088;
min-height: 325px;
border: 2px solid #144088;
color: white;
}
.service::before {
content: "";
float: right;
width: 100%;
height: 100%;
background: url(https://images.unsplash.com/photo-1645069258059-6f5a71256c4a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2076&q=80) left center/150%;
shape-outside: polygon(79% 0, 100% 0, 100% 100%, 42% 100%);
clip-path: polygon(79% 0, 100% 0, 100% 100%, 42% 100%);
shape-margin: .3em;
}
.service::after {
content: "01";
position: absolute;
top: 0;
font-size: 60px;
font-weight: bold;
line-height: 1;
opacity: 25%;
}
.service__content {
padding: 3rem 0 1rem 1rem;
height: 100%;
}
.service__title {
font-size: 26px;
}
.service__description {
font-size: clamp(12px, 3vw + .25rem, 16px);
}
.service__title, .service__description {
margin-bottom: 1rem;
}
.service__link {
display: inline-flex;
justify-content: space-between;
align-items: center;
width: 35%;
}
.service__link a {
color: white;
}
.service__link img {
filter: brightness(0)invert(1);
}
#media screen and (max-width: 1200px) {
.service {
flex: 0 1 518px;
}
}
<body>
<div class="service-container">
<div class="service">
<div class="service__content">
<h4 class="service__title">Lorem</h4>
<p class="service__description">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Placeat doloremque molestiae eligendi voluptas veniam repellendus, aperiam tempora suscipit consectetur sint?</p>
<div class="service__link">
Link
<img src="https://img.icons8.com/ios/26/000000/image.png"/>
</div>
</div>
</div>
<div class="service">
<div class="service__content">
<h4 class="service__title">Lorem</h4>
<p class="service__description">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Placeat doloremque molestiae eligendi voluptas veniam repellendus, aperiam tempora suscipit consectetur sint?</p>
<div class="service__link">
Link
<img src="https://img.icons8.com/ios/26/000000/image.png"/>
</div>
</div>
</div>
<div class="service">
<div class="service__content">
<h4 class="service__title">Lorem</h4>
<p class="service__description">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Placeat doloremque molestiae eligendi voluptas veniam repellendus, aperiam tempora suscipit consectetur sint?</p>
<div class="service__link ">
Link
<img src="https://img.icons8.com/ios/26/000000/image.png"/>
</div>
</div>
</div>
</div>
</body>
What is going on when display: flex is added to .service__content?
Also, if anybody has a better idea of how to make this component in general I'd love to hear it.
Thanks!
I think you could use this:
position: absolute; bottom: 30px
to put it in the bottom part of the div.
If you set service__link to flex instead of inline flex and add margin-top auto it should stay on the bottom
you have to give position : relative for container
than for service__link position: absolute; left:10px; bottom:10px;
there will be no deterioration in smaller screen.
.service__content {
padding: 3rem 0 1rem 1rem;
height: 100%;
position: relative; // Added
}
.service__link {
display: inline-flex;
justify-content: space-between;
align-items: center;
width: 35%;
position: absolute; // Added
left:10px; // Added
bottom:10px; // Added
}
*, *::before, *::after {
box-sizing: border-box;
}
* {
padding: 0;
margin: 0;
}
body {
min-height: 100vh;
font-family: Arial;
}
.service-container {
max-width: 1800px;
margin-inline: auto;
padding: 40px 15px;
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 1.5rem;
}
.service {
flex: 1 1 calc(33.3336% - 1.5rem);
display: inline-block;
position: relative;
background: #144088;
min-height: 325px;
border: 2px solid #144088;
color: white;
}
.service::before {
content: "";
float: right;
width: 100%;
height: 100%;
background: url(https://images.unsplash.com/photo-1645069258059-6f5a71256c4a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2076&q=80) left center/150%;
shape-outside: polygon(79% 0, 100% 0, 100% 100%, 42% 100%);
clip-path: polygon(79% 0, 100% 0, 100% 100%, 42% 100%);
shape-margin: .3em;
}
.service::after {
content: "01";
position: absolute;
top: 0;
font-size: 60px;
font-weight: bold;
line-height: 1;
opacity: 25%;
}
.service__content {
padding: 3rem 0 1rem 1rem;
height: 100%;
position:relative;
}
.service__title {
font-size: 26px;
}
.service__description {
font-size: clamp(12px, 3vw + .25rem, 16px);
}
.service__title, .service__description {
margin-bottom: 1rem;
}
.service__link {
display: inline-flex;
justify-content: space-between;
align-items: center;
width: 35%;
position:absolute;
left:10px;
bottom:10px;
}
.service__link a {
color: white;
}
.service__link img {
filter: brightness(0)invert(1);
}
#media screen and (max-width: 1200px) {
.service {
flex: 0 1 518px;
}
}
<body>
<div class="service-container">
<div class="service">
<div class="service__content">
<h4 class="service__title">Lorem</h4>
<p class="service__description">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Placeat doloremque molestiae eligendi voluptas veniam repellendus, aperiam tempora suscipit consectetur sint?</p>
<div class="service__link">
Link
<img src="https://img.icons8.com/ios/26/000000/image.png"/>
</div>
</div>
</div>
<div class="service">
<div class="service__content">
<h4 class="service__title">Lorem</h4>
<p class="service__description">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Placeat doloremque molestiae eligendi voluptas veniam repellendus, aperiam tempora suscipit consectetur sint?</p>
<div class="service__link">
Link
<img src="https://img.icons8.com/ios/26/000000/image.png"/>
</div>
</div>
</div>
<div class="service">
<div class="service__content">
<h4 class="service__title">Lorem</h4>
<p class="service__description">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Placeat doloremque molestiae eligendi voluptas veniam repellendus, aperiam tempora suscipit consectetur sint?</p>
<div class="service__link ">
Link
<img src="https://img.icons8.com/ios/26/000000/image.png"/>
</div>
</div>
</div>
</div>
</body>
I am having a problem with positioning, everything works fine except the last section contactform.
The problem is that when I zoom in, the contactform overlaps on services section.
Here's the code:
.services {
width: 100%;
height: 160vh;
margin: 100px 0;
position: relative;
}
.services-content {
/* position: relative; */
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.services-content h1 {
font-size: 40px;
letter-spacing: 4px;
}
.content-row-one {
width: 90%;
height: 100%;
justify-content: center;
display: flex;
margin-top: 100px;
}
.row-one {
display: flex;
width: 85%;
height: 300px;
margin: 20px 30px;
}
.quality-management {
display: flex;
flex-direction: column;
width: 35%;
height: 200px;
margin: 0px 60px;
}
.quality-management h6 {
font-size: 18px;
text-transform: uppercase;
}
.testing-calibration {
display: flex;
flex-direction: column;
width: 35%;
height: 200px;
margin: 0px 60px;
}
.testing-calibration h6 {
font-size: 18px;
text-transform: uppercase;
}
.medical-devices {
display: flex;
flex-direction: column;
width: 35%;
height: 200px;
margin: 0px 60px;
}
.medical-devices h6 {
font-size: 18px;
text-transform: uppercase;
}
.content-row-two {
width: 90%;
height: 100%;
justify-content: center;
display: flex;
}
.row-two {
display: flex;
width: 85%;
height: 300px;
margin: 20px 30px;
}
.lead-auditor {
display: flex;
flex-direction: column;
width: 35%;
height: 200px;
margin: 0px 60px;
}
.lead-auditor h6 {
font-size: 18px;
text-transform: uppercase;
}
.project-management {
display: flex;
flex-direction: column;
width: 35%;
height: 24px;
margin: 0px 60px;
}
.project-management h6 {
font-size: 18px;
text-transform: uppercase;
}
.quality-assurance {
display: flex;
flex-direction: column;
width: 35%;
height: 200px;
margin: 0px 60px;
}
.quality-assurance h6 {
font-size: 18px;
text-transform: uppercase;
}
.content-row-three {
width: 90%;
height: 100%;
justify-content: center;
display: flex;
}
.row-three {
display: flex;
width: 85%;
height: 300px;
margin: 20px 30px;
}
.document-management {
display: flex;
flex-direction: column;
width: 35%;
height: 200px;
margin: 0px 60px;
}
.document-management h6 {
font-size: 18px;
text-transform: uppercase;
}
.contactform {
width: 100%;
height: 50vh;
position: relative;
}
.contact {
width: 100%;
height: 100%;
text-align: center;
}
.contact h1 {
font-size: 40px;
letter-spacing: 4px;
}
.contact-content {
width: 70%;
height: 100%;
display: flex;
/* justify-content: center;
text-align: center; */
margin: 0 auto;
/* position: absolute; */
margin-top: 50px;
}
.contact-column-one {
width: 33%;
height: 50%;
}
.contact-column-one .location i {
font-size: 50px;
cursor: pointer;
}
.contact-column-one .location i:hover{
color: rgb(19, 112, 233);
transition: .5s;
}
.contact-column-one h1 {
font-size: 30px;
}
.contact-column-two {
width: 33%;
height: 50%;
}
.contact-column-two .phone i {
font-size: 50px;
cursor: pointer;
}
.contact-column-two .phone i:hover {
color: rgb(19, 112, 233);
transition: .5s;
}
.contact-column-two h1 {
font-size: 30px;
}
.contact-column-three {
width: 33%;
height: 50%;
}
.contact-column-three .email i {
font-size: 50px;
cursor: pointer;
}
.contact-column-three .email i:hover {
color: rgb(19, 112, 233);
transition: .5s;
}
.contact-column-three h1 {
font-size: 30px;
}
<section class="services" id="services">
<div class="services-content">
<h1>OUR SERVICES</h1>
<div class="content-row-one">
<div class="row-one">
<div class="quality-management">
<h6>1. Quality Management Systems according to ISO 9000 2015</h6>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. In omnis magni praesentium velit sit
sapiente sed magnam accusamus quisquam, maxime rem! Adipisci, quisquam? Dolor fugiat dolores
porro
quo perferendis accusamus!</p>
</div>
<div class="testing-calibration">
<h6>2. Quality Management Systems for Testing and Calibration Laboratories</h6>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. In omnis magni praesentium velit sit
sapiente sed magnam accusamus quisquam, maxime rem! Adipisci, quisquam? Dolor fugiat dolores
porro
quo perferendis accusamus!</p>
</div>
<div class="medical-devices">
<h6>3. Quality Management for Medical Devices according to ISO 13485</h6>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. In omnis magni praesentium velit sit
sapiente sed magnam accusamus quisquam, maxime rem! Adipisci, quisquam? Dolor fugiat dolores
porro
quo perferendis accusamus!</p>
</div>
</div>
</div>
<div class="content-row-two">
<div class="row-two">
<div class="lead-auditor">
<h6>4. Lead Auditor according to ISO 9001</h6>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. In omnis magni praesentium velit sit
sapiente sed magnam accusamus quisquam, maxime rem! Adipisci, quisquam? Dolor fugiat dolores
porro
quo perferendis accusamus!</p>
</div>
<div class="project-management">
<h6>5. Project Management</h6>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. In omnis magni praesentium velit sit
sapiente sed magnam accusamus quisquam, maxime rem! Adipisci, quisquam? Dolor fugiat dolores
porro
quo perferendis accusamus!</p>
</div>
<div class="quality-assurance">
<h6>6. Quality Assurance</h6>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. In omnis magni praesentium velit sit
sapiente sed magnam accusamus quisquam, maxime rem! Adipisci, quisquam? Dolor fugiat dolores
porro
quo perferendis accusamus!</p>
</div>
</div>
</div>
<div class="content-row-three">
<div class="row-three">
<div class="document-management">
<h6>7. Document Management with SharePoint Server</h6>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. In omnis magni praesentium velit sit
sapiente sed magnam accusamus quisquam, maxime rem! Adipisci, quisquam? Dolor fugiat dolores
porro
quo perferendis accusamus!</p>
</div>
</div>
</div>
</section>
<section class="contactform" id="contactform">
<div class="contact">
<h1>CONTACT US</h1>
<div class="contact-content">
<div class="contact-column-one">
<span class="location">
<i class="material-icons">
place
</i>
</span>
<h1>ADDRESS</h1>
<p>Address</p>
</div>
<div class="contact-column-two">
<span class="phone">
<i class="material-icons">
phone
</i>
</span>
<h1>PHONE</h1>
<p>Phone Number</p>
</div>
<div class="contact-column-three">
<span class="email">
<i class="material-icons">
email
</i>
</span>
<h1>EMAIL</h1>
<p>Email</p>
</div>
</div>
</div>
</section>
I've tried removing position, from absolute to relative and vice versa, but nothing changed.
If you need more code or explanation please feel free to ask.
Thank you for your time!
Here's a photo:
While you have a fixed height for .services it will always overlap when the content total height higher than .services height, instead you could use min-height so if the content height less than 160vh the height will remain 160vh but if the content height more than 160vh then .services height will grow corresponding to the content.
.services {
width: 100%;
min-height: 160vh;
margin: 100px 0;
position: relative;
}
.services-content {
/* position: relative; */
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.services-content h1 {
font-size: 40px;
letter-spacing: 4px;
}
.content-row-one {
width: 90%;
height: 100%;
justify-content: center;
display: flex;
margin-top: 100px;
}
.row-one {
display: flex;
width: 85%;
height: 300px;
margin: 20px 30px;
}
.quality-management {
display: flex;
flex-direction: column;
width: 35%;
height: 200px;
margin: 0px 60px;
}
.quality-management h6 {
font-size: 18px;
text-transform: uppercase;
}
.testing-calibration {
display: flex;
flex-direction: column;
width: 35%;
height: 200px;
margin: 0px 60px;
}
.testing-calibration h6 {
font-size: 18px;
text-transform: uppercase;
}
.medical-devices {
display: flex;
flex-direction: column;
width: 35%;
height: 200px;
margin: 0px 60px;
}
.medical-devices h6 {
font-size: 18px;
text-transform: uppercase;
}
.content-row-two {
width: 90%;
height: 100%;
justify-content: center;
display: flex;
}
.row-two {
display: flex;
width: 85%;
height: 300px;
margin: 20px 30px;
}
.lead-auditor {
display: flex;
flex-direction: column;
width: 35%;
height: 200px;
margin: 0px 60px;
}
.lead-auditor h6 {
font-size: 18px;
text-transform: uppercase;
}
.project-management {
display: flex;
flex-direction: column;
width: 35%;
height: 24px;
margin: 0px 60px;
}
.project-management h6 {
font-size: 18px;
text-transform: uppercase;
}
.quality-assurance {
display: flex;
flex-direction: column;
width: 35%;
height: 200px;
margin: 0px 60px;
}
.quality-assurance h6 {
font-size: 18px;
text-transform: uppercase;
}
.content-row-three {
width: 90%;
height: 100%;
justify-content: center;
display: flex;
}
.row-three {
display: flex;
width: 85%;
height: 300px;
margin: 20px 30px;
}
.document-management {
display: flex;
flex-direction: column;
width: 35%;
height: 200px;
margin: 0px 60px;
}
.document-management h6 {
font-size: 18px;
text-transform: uppercase;
}
.contactform {
width: 100%;
height: 50vh;
position: relative;
}
.contact {
width: 100%;
height: 100%;
text-align: center;
}
.contact h1 {
font-size: 40px;
letter-spacing: 4px;
}
.contact-content {
width: 70%;
height: 100%;
display: flex;
/* justify-content: center;
text-align: center; */
margin: 0 auto;
/* position: absolute; */
margin-top: 50px;
}
.contact-column-one {
width: 33%;
height: 50%;
}
.contact-column-one .location i {
font-size: 50px;
cursor: pointer;
}
.contact-column-one .location i:hover{
color: rgb(19, 112, 233);
transition: .5s;
}
.contact-column-one h1 {
font-size: 30px;
}
.contact-column-two {
width: 33%;
height: 50%;
}
.contact-column-two .phone i {
font-size: 50px;
cursor: pointer;
}
.contact-column-two .phone i:hover {
color: rgb(19, 112, 233);
transition: .5s;
}
.contact-column-two h1 {
font-size: 30px;
}
.contact-column-three {
width: 33%;
height: 50%;
}
.contact-column-three .email i {
font-size: 50px;
cursor: pointer;
}
.contact-column-three .email i:hover {
color: rgb(19, 112, 233);
transition: .5s;
}
.contact-column-three h1 {
font-size: 30px;
}
<section class="services" id="services">
<div class="services-content">
<h1>OUR SERVICES</h1>
<div class="content-row-one">
<div class="row-one">
<div class="quality-management">
<h6>1. Quality Management Systems according to ISO 9000 2015</h6>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. In omnis magni praesentium velit sit
sapiente sed magnam accusamus quisquam, maxime rem! Adipisci, quisquam? Dolor fugiat dolores
porro
quo perferendis accusamus!</p>
</div>
<div class="testing-calibration">
<h6>2. Quality Management Systems for Testing and Calibration Laboratories</h6>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. In omnis magni praesentium velit sit
sapiente sed magnam accusamus quisquam, maxime rem! Adipisci, quisquam? Dolor fugiat dolores
porro
quo perferendis accusamus!</p>
</div>
<div class="medical-devices">
<h6>3. Quality Management for Medical Devices according to ISO 13485</h6>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. In omnis magni praesentium velit sit
sapiente sed magnam accusamus quisquam, maxime rem! Adipisci, quisquam? Dolor fugiat dolores
porro
quo perferendis accusamus!</p>
</div>
</div>
</div>
<div class="content-row-two">
<div class="row-two">
<div class="lead-auditor">
<h6>4. Lead Auditor according to ISO 9001</h6>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. In omnis magni praesentium velit sit
sapiente sed magnam accusamus quisquam, maxime rem! Adipisci, quisquam? Dolor fugiat dolores
porro
quo perferendis accusamus!</p>
</div>
<div class="project-management">
<h6>5. Project Management</h6>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. In omnis magni praesentium velit sit
sapiente sed magnam accusamus quisquam, maxime rem! Adipisci, quisquam? Dolor fugiat dolores
porro
quo perferendis accusamus!</p>
</div>
<div class="quality-assurance">
<h6>6. Quality Assurance</h6>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. In omnis magni praesentium velit sit
sapiente sed magnam accusamus quisquam, maxime rem! Adipisci, quisquam? Dolor fugiat dolores
porro
quo perferendis accusamus!</p>
</div>
</div>
</div>
<div class="content-row-three">
<div class="row-three">
<div class="document-management">
<h6>7. Document Management with SharePoint Server</h6>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. In omnis magni praesentium velit sit
sapiente sed magnam accusamus quisquam, maxime rem! Adipisci, quisquam? Dolor fugiat dolores
porro
quo perferendis accusamus!</p>
</div>
</div>
</div>
</section>
<section class="contactform" id="contactform">
<div class="contact">
<h1>CONTACT US</h1>
<div class="contact-content">
<div class="contact-column-one">
<span class="location">
<i class="material-icons">
place
</i>
</span>
<h1>ADDRESS</h1>
<p>Address</p>
</div>
<div class="contact-column-two">
<span class="phone">
<i class="material-icons">
phone
</i>
</span>
<h1>PHONE</h1>
<p>Phone Number</p>
</div>
<div class="contact-column-three">
<span class="email">
<i class="material-icons">
email
</i>
</span>
<h1>EMAIL</h1>
<p>Email</p>
</div>
</div>
</div>
</section>
You should set height: auto;
jsfiddle:
https://jsfiddle.net/qhsygpb5/
Explanation: when you set "height: 200px" element height will be 200px no matter how much content contains. Other solution is to add "overflow:hidden;" but than you will not see all content if there is not room. Also you can add "overflow: scroll;" if you want to scroll the content within 200px height.
Below i write the code, in this code i want to make responsive 'rectangle' and 'square' and i also want to make resopnsive text in the p tag.
#rectangle
{
display: flex;
width: 500px;
height: 150px;
background-color: brown;
}
#square
{
width: 300px;
height: 130px;
background-color: chocolate;
margin: 10px;
}
<div id="rectangle">
<div id="square">
</div>
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Aut, iusto. Sapiente fugiat illo
dolorum assumenda commodi!
</p>
</div>
For the widths and heights, use % instead of px. For the text, add an id or class that defines a font using the vw unit. For example:
<div id="rectangle">
<div id="square">
</div>
<p id='text'>
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Aut, iusto. Sapiente
fugiat illo dolorum assumenda commodi!
</p>
</div>
#rectangle
{
background-color: brown;
display: flex;
height: 8%;
position: relative;
width: 10%;
}
#square
{
background-color: chocolate;
height: 8%;
margin: 10px;
position: relative;
width: 10%;
}
#text
{
font-size: 2vw;
}
Here you go. If you want responsiveness, use % or vh / vw
#rectangle
{
display: flex;
width: 70vw;
height: 40vh;
background-color: brown;
font-size: 2.3vw;
}
#square
{
width: 100%;
height: 100%;
background-color: chocolate;
margin-right: 3%;
display: flex;
align-items: center;
justify-content: center;
}
.arrow-up {
display: flex;
align-items: center;
justify-content: center;
width: 0;
height: 0;
border-left: 10vw solid transparent;
border-right: 10vw solid transparent;
border-bottom: 10vw solid black;
}
<div id="rectangle">
<div id="square">
<div class="arrow-up"></div>
</div>
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Aut, iusto. Sapiente fugiat illo
dolorum assumenda commodi!
</p>
</div>