How do I horizontally align images? (CSS and HTML) - html

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.

Related

Position element at the bottom of container without flex or position absolute

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>

how to control the space between two sections in bootstrap on small screens

while I am making a responsive site with bootstrap, I give min-height 100vh for both the home and about section. it looks nice for the large screen, but for the small screen, there is more space between the home section and the about section. how can I control that space for the small screen? I tried media queries to control the space between the home and about section for the small screen. I can't fix this. so tell me how to control that.
.row {
display: flex !important;
justify-content: flex-end !important;
align-items: center;
min-height: 100vh;
}
.first__para {
font-size: 1.5rem;
}
.landing__btn {
text-decoration: none;
color: #0275d8;
font-size: 1.5rem;
}
.landing__btn::after {
content: "";
height: 2px;
width: 0px;
opacity: ;
background: #0275d8;
display: block;
position: absolute;
transition: .3s;
}
.landing__btn:hover::after {
content: "";
height: 2px;
width: 105px;
background: #0275d8;
display: block;
position: absolute;
transition: .3s;
transform-origin: 0%;
z-index: 10;
}
.about__head {
color: #0275d8
}
.about__para {
font-size: 1.5rem;
}
.about__btn {
text-decoration: none;
color: #0275d8;
font-size: 1.5rem;
}
.about__btn::after {
content: "";
height: 2px;
width: 0px;
opacity: ;
background: #0275d8;
display: block;
position: absolute;
transition: .3s;
}
.about__btn:hover::after {
content: "";
height: 2px;
width: 130px;
background: #0275d8;
display: block;
position: absolute;
transition: .3s;
transform-origin: 0%;
z-index: 10;
}
<!--landing page-->
<div class="container">
<div class="row">
<div class="col-12 col-md-12 col-lg-12">
<h1 class="text-primary">the vollmonds</h1>
<p class="first__para">Businesses get blinded by the allure of a large subscription list, <br>but unengaged subscribers aren't just not interested in what you're sending, they're actually harming your deliverability</p>
for more<span></span>
</div>
</div>
</div>
<!--landing-page-->
<!--about-->
<div class="container">
<div class="row">
<div class="col-12 col-lg-6">
<img src="https://cdni.iconscout.com/illustration/premium/thumb/startup-business-1460503-1234533.png" alt="marketting">
</div>
<div class="col-12 col-lg-6">
<h1 class="about__head">about</h1>
<p class="about__para">Lorem ipsum dolor sit, amet consectetur adipisicing elit. Consequuntur, nisi dicta voluptatem cumque eius, <br>facere veritatis beatae rerum maxime ea accusamus, cum dolore ipsam quasi fugiat sit ullam error quas!</p>
<p class="about__para">Lorem ipsum dolor sit, amet consectetur adipisicing elit. Consequuntur, nisi dicta voluptatem cumque eius, <br>facere veritatis beatae rerum maxime ea accusamus, cum dolore ipsam quasi fugiat sit ullam error quas!</p>
learn more
</div>
</div>
</div>
<!--about-->
I recommend adding some CSS that will increase margin on top of additional .container elements (or any class you name them), and then a media query to remove the margin if you desire. Code below for reference
.row {
display: flex !important;
justify-content: flex-end !important;
align-items: center;
min-height: 100vh;
}
.first__para {
font-size: 1.5rem;
}
.landing__btn {
text-decoration: none;
color: #0275d8;
font-size: 1.5rem;
}
.landing__btn::after {
content: "";
height: 2px;
width: 0px;
opacity: ;
background: #0275d8;
display: block;
position: absolute;
transition: .3s;
}
.landing__btn:hover::after {
content: "";
height: 2px;
width: 105px;
background: #0275d8;
display: block;
position: absolute;
transition: .3s;
transform-origin: 0%;
z-index: 10;
}
.about__head {
color: #0275d8
}
.about__para {
font-size: 1.5rem;
}
.about__btn {
text-decoration: none;
color: #0275d8;
font-size: 1.5rem;
}
.about__btn::after {
content: "";
height: 2px;
width: 0px;
opacity: ;
background: #0275d8;
display: block;
position: absolute;
transition: .3s;
}
.about__btn:hover::after {
content: "";
height: 2px;
width: 130px;
background: #0275d8;
display: block;
position: absolute;
transition: .3s;
transform-origin: 0%;
z-index: 10;
}
/* New CSS */
.container + .container {
margin-top: 50px;
}
#media screen and (min-width: 768px) {
.container + .container {
margin-top: 0;
}
}
<!--landing page-->
<div class="container">
<div class="row">
<div class="col-12 col-md-12 col-lg-12">
<h1 class="text-primary">the vollmonds</h1>
<p class="first__para">Businesses get blinded by the allure of a large subscription list, <br>but unengaged subscribers aren't just not interested in what you're sending, they're actually harming your deliverability</p>
for more<span></span>
</div>
</div>
</div>
<!--landing-page-->
<!--about-->
<div class="container">
<div class="row">
<div class="col-12 col-lg-6">
<img src="https://cdni.iconscout.com/illustration/premium/thumb/startup-business-1460503-1234533.png" alt="marketting">
</div>
<div class="col-12 col-lg-6">
<h1 class="about__head">about</h1>
<p class="about__para">Lorem ipsum dolor sit, amet consectetur adipisicing elit. Consequuntur, nisi dicta voluptatem cumque eius, <br>facere veritatis beatae rerum maxime ea accusamus, cum dolore ipsam quasi fugiat sit ullam error quas!</p>
<p class="about__para">Lorem ipsum dolor sit, amet consectetur adipisicing elit. Consequuntur, nisi dicta voluptatem cumque eius, <br>facere veritatis beatae rerum maxime ea accusamus, cum dolore ipsam quasi fugiat sit ullam error quas!</p>
learn more
</div>
</div>
</div>
<!--about-->

Flip box hover with image as background

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.

section overlaps on another section

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.

How to create a responsive div where inside it have a squre and some texts

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>