I have 4 icons on the landing page I'm building, each in their own div. For some reason, rather than keeping all 4 on the same line and resizing automatically, it keeps 3 on one line, and the 4th is always on a 2nd line, as you can see in the image below. What could be causing this to happen to just that one icon?
Here's the HTML:
<section id="services">
<div class="container">
<div class="row" id="services-positioning">
<div class="col-md-4 service-content sc1">
<span><i class="fa fa-hdd-o"></i></span>
<h4>Get Inspired</h4>
</div>
<div class="col-md-4 service-content sc2">
<span><i class="fa fa-diamond"></i></span>
<h4>Get Rewarded</h4>
</div>
<div class="col-md-4 service-content sc3">
<span><i class="fa fa-envelope-o"></i></span>
<h4>Be Creative</h4>
</div>
<div class="col-md-4 service-content sc4">
<span><i class="fa fa-envelope-o"></i></span>
<h4>Stay Connected</h4>
</div>
</div>
</div>
</section>
Relevant CSS:
#services {
padding: 100px 0;
}
.container {
width: 100%;
max-width: 400px;
}
#services2 .col-md-4 {
margin-bottom: 50px;
}
.service-content {
cursor: pointer;
}
/*
#services-positioning{
display: inline-block;
}
*/
.service-content span {
display: table;
margin: 0px auto 25px;
color: #3498db;
text-align: center;
transition: 0.3s;
-webkit-transition: 0.3s;
position: relative;
border: 2px solid #3498db;
width: 100px;
height: 100px;
display: table;
font-size: 35px;
border-radius: 50%;
padding-top: 22px;
}
.service-content:hover span {
background: #3498db;
color: #fff;
transition: 0.3s;
-webkit-transition: 0.3s;
}
.service-content:hover i {
transition: 0.3s;
-webkit-transition: 0.3s;
}
.service-content h4 {
font-size: 17px;
text-align: center;
font-weight: 700;
margin: 0px 0px 10px;
text-transform: none;
letter-spacing: 0.5px;
text-transform: uppercase;
}
.service-content p {
font-size: 14px;
text-align: center;
line-height: 22px;
margin: 0 0 10px;
color: #777;
font-weight: 300;
padding: 0 20px;
}
.service-content a {
color: #3498DB;
font-size: 14px;
text-align: center;
display: table;
margin: 0 auto;
}
.service-content a i {
font-size: 14px;
margin-left: 5px;
}
.service-content a:hover {
color: #000;
}
Change from col-md-4 to col-md-3. In Bootstrap, "col-md-4" means that, on a "medium"-width viewport (or larger), the element will span across 4 columns out of a total of 12 (twelve is just the arbitrary number of columns that exist in Bootstrap). Thus, only 3 items with that class name can fit in a line.
Here's a nice visual explanation of Bootstrap's grid system from their official docs.
Related
body {
font-family: Bahnschrift SemiBold, sans-serif;
background-color: #fcfefe;
width: 100%;
height: 100%;
overflow-x: hidden;
}
*{
margin:0; padding: 0;
}
.logonav{
position: top;
left: 0px;
width: 250px;
height: 65px;
padding-top: 70px;
padding-bottom: 20px;
padding-left: 40px;
}
.content{
position: absolute;
bottom: 330px;
left: 30px;
text-align: justify;
font-size: 20px;
font-family: 'Titillium Web', sans-serif;
color: #ffffff;
}
.bn632-hover {
position: absolute;
bottom: 200px;
left: 1200px;
width: 160px;
font-size: 16px;
font-weight: 600;
color: #00bbf0;
cursor: pointer;
margin: 20px;
height: 55px;
text-align:center;
color: whitesmoke;
border: none;
background-size: 300% 100%;
border-radius: 50px;
moz-transition: all .4s ease-in-out;
-o-transition: all .4s ease-in-out;
-webkit-transition: all .4s ease-in-out;
transition: all .4s ease-in-out;
}
.bn632-hover:hover {
background-position: 100% 0;
moz-transition: all .4s ease-in-out;
-o-transition: all .4s ease-in-out;
-webkit-transition: all .4s ease-in-out;
transition: all .4s ease-in-out;
}
.bn632-hover:focus {
outline: none;
}
.bn632-hover.bn18 {
background-image: linear-gradient(
to right,
#25aae1,
#00bbf0,
#00bbf0,
#00bbf0
);
box-shadow: 0 4px 15px 0 rgba(49, 196, 190, 0.75);
}
.image_container.img{
max-height: 100vh;
max-width: 100%;
object-fit: cover;
object-position: bottom;
}
.pozadina{
background-color: #83a3c7;
background-image: url("womandoctor.jpg");
background-size: cover;
width: 110%;
background-blend-mode: normal;
position: relative;
padding-top: 450px;
padding-bottom: 100px;
}
.hornav1{
overflow: hidden;
width: 100%;
background-color: #00bbf0;
list-style-type: none;
margin: 0px;
padding: 0px;
border-bottom: solid 2px #eaf6f6;
size: 100px;
position:fixed;
top:0;
z-index:100;
}
.hornav1 a{
float: right;
color: whitesmoke;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
box-sizing: border-box;
margin-left: 5px 10 px;
}
.hornav1 i{
color: whitesmoke;
}
#pocetna{
padding-right: 1000px;
font-size: 20px;
}
.hornav2{
overflow: hidden;
width: 100%;
background-color: #ffffff;
list-style-type: none;
margin: 0px;
padding: 0px;
position: sticky;
top: 0px;
border-bottom: solid 2px #eaf6f6;
}
.hornav2 a{
float: right;
color: #333;
text-align: center;
padding: 14px 16px;
font-size: 17px;
box-sizing: border-box;
margin-left: 5px 10 px;
}
.hornav3{
overflow: hidden;
width: 100%;
background-color: #00bbf0;
list-style-type: none;
margin: 0px;
padding: 10px;
position:sticky;
border-bottom: solid 2px #eaf6f6;
size: 150px;
}
.hornav3 a{
position: relative;
color: whitesmoke;
text-align: center;
padding-left: 50px;
text-decoration: none;
font-size: 24px;
box-sizing: border-box;
right : -270px;
}
.navcontainer{
top:0;
width:100%;
z-index:100;
}
.hornav3 a::before{
content: '';
position: absolute;
bottom: 0;
right: 0;
width: 0;
height: 2px;
background-color: whitesmoke;
transition: width 0.6s cubic-bezier(0.5, 1, 0.5, 1);
}
#media (hover: hover) and (pointer: fine) {
.hornav3 a:hover::before{
left: 0.5;
right: auto;
width: 70%;
}
}
.pregledi{
background-color: #fafafa;
}
.pregledi .heading{
padding-top: 40px;
text-transform: uppercase;
color: deepskyblue;
text-align: center;
font-size: 35px;
}
.pregledi .heading2{
padding-top: 5px;
text-align: center;
font-size: 20px;
font-family: unset;
color: #2c5d63;
}
.pregledi .box-container{
padding-top: 30px;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(20rem, 7fr));
gap:4rem;
margin-left: 60px;
margin-right: 30px;
}
.pregledi .box-container .box h3{
padding-top: 10px;
color: deepskyblue;
text-transform: uppercase;
font-size: 2.1rem;
}
.pregledi .box-container .box p{
padding-top: 10px;
font-family: sans-serif;
font-size: 1rem;
line-height: 1;
}
.pregledi .box-container .box a{
position: relative;
top: 10px;
}
.bn111 {
margin-top: 10px;
padding: 1.3em 0.01em;
font-size: 12px;
text-transform: uppercase;
text-indent: 10px;
letter-spacing: 2.5px;
font-weight: 500;
color: #ffffff;
background-color: #00bbf0;
border: none;
border-radius: 45px;
box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.1);
transition: all 0.24s ease 0s;
cursor: pointer;
outline: none;
}
.bn111:hover {
background-color: #00bbf0;
box-shadow: 0px 15px 20px rgba(34, 180, 255, 0.4);
color: #ffffff;
transform: translateX(7px) translateY(-1.1px);
}
.bn111:active {
transform: translateY(-1px);
}
.bn111 i{
color: #ffffff;
font-size: 1.3em;
padding-right: 4px;
}
.izborna{
background-color: #83a3c7;
background-size: cover;
width: 100%;
background-blend-mode: normal;
opacity: 1;
display: block;
height: auto;
transition: .5s ease;
backface-visibility: hidden;
}
.containerslike{
position: relative;
width: 100%;
max-width: 400px;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 100%;
width: 100%;
opacity: 0;
transition: .3s ease;
background-color: #ececec;
}
.containerslike:hover .overlay {
opacity: 0.5;
}
.ikona {
color: deepskyblue;
font-size: 40px;
position: absolute;
top: 100%;
left: 45%;;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
text-align: center;
opacity: 1;
}
.fa-magnifying-glass{
position: absolute;
top: 100px;
}
.bn112 {
margin-top: 10px;
padding: 1.3em 0.01em;
font-size: 18px;
text-transform: uppercase;
text-indent: 10px;
letter-spacing: 2.5px;
font-weight: 500;
color: #ffffff;
background-color: #00bbf0;
border: none;
border-radius: 45px;
box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.1);
transition: all 0.24s ease 0s;
cursor: pointer;
outline: none;
width: 400px;
}
.bn112:hover {
background-color: #00bbf0;
box-shadow: 0px 15px 20px rgba(34, 180, 255, 0.4);
color: #ffffff;
transform: translateY(-1.1px);
}
.bn112:active {
transform: translateY(-1px);
}
.bn112 i{
color: #ffffff;
font-size: 1.3em;
padding-right: 4px;
}
.podnopregled{
margin-left: 500px;
}
.infodiv{
margin-top: 30px;
background-color: deepskyblue;
}
.row {
display: flex;
width: 100%;
}
.noMargin {
margin: 1px;
}
.one {
background-color: #79c2d0;
border: solid #ececec;
height: 300px;
width: 100%;
border-radius: 15px;
margin-top: 30px;
}
.two {
background-color: #79c2d0;
border: solid #ececec;
height: 300px;
width: 100%;
border-radius: 15px;
margin-top: 30px;
}
.three {
background-color: #79c2d0;
border: solid #ececec;
height: 300px;
width: 100%;
border-radius: 15px;
margin-top: 10px;
}
.four {
background-color: #79c2d0;
border: solid #ececec;
height: 300px;
width: 100%;
border-radius: 15px;
margin-top: 10px;
}
.noMargin p{
text-align: center;
margin-top: 100px;
}
#media only screen and (max-width:800px) {
/* For tablets: */
.main {
width: 80%;
padding: 0;
}
.right {
width: 100%;
}
}
#media only screen and (max-width:500px) {
/* For mobile phones: */
.menu, .main, .right {
width: 100%;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>VivaMed medicina rada i sporta</title>
<script src="https://kit.fontawesome.com/60681a69ff.js" crossorigin="anonymous"></script>
<link rel="stylesheet" type="text/css" href="VivamedCSS.css">
<link href="https://fonts.googleapis.com/css2?family=Titillium+Web:wght#300&display=swap" rel="stylesheet">
</head>
<body>
<div class="navcontainer">
<div class="hornav1">
<i class="fas fa-envelope" style="font-size:20px;"></i> info#vivamed.hr
<i class="fa-solid fa-phone"style="font-size:20px;" ></i> +385 1 233 55 00
Početna
</div>
<div class="hornav2">
<img src="vivalogo.webp" alt="logo" class="logonav">
<a class="active" style="font-size: 20px; padding-right: 550px; padding-top: 100px; font-family: 'Titillium Web', sans-serif; font-style: italic; font-weight: bolder;"> Zdrav radnik je uspješan i produktivan radnik.</a>
</div>
<div class="hornav3">
<a class="active" href="https://www.vivamed.hr/kontakt"><i class="fas fa-envelope" style="font-size:20px;"></i> Kontakt</a>
<a class="active" href="https://www.vivamed.hr/kontakt"><i class="fas fa-cloud" style="font-size:20px; color: whitesmoke;"></i> Kontakt</a>
<a class="active" href="https://www.vivamed.hr/kontakt"><i class="fas fa-comment" style="font-size:20px;"></i> Kontakt</a>
<a class="active" href="https://www.vivamed.hr/kontakt"><i class="fas fa-car" style="font-size:20px;"></i> Kontakt</a>
<a class="active" href="https://www.vivamed.hr/galerija"><i class="fas fa-bolt" style="font-size:20px;"></i> O nama</a>
<a class="active" href="file:///C:/Users/Admin/Desktop/Vivamed/VIVAMED%20JEDAN.html#slide-2"><i class="fas fa-envelope"></i> Početna</a>
</div>
</div>
<div class="pozadina">
<div class="content">
<h3>Dobro došli na stranicu Medicine rada i sporta VivaMed!</h3>
<p>Pogledajte sve profesionalne usluge koje nudi
<br>naš tim vrhunskih i renomiranih stručnjaka!
</p>
</div>
<button class="bn632-hover bn18">Naručite se!</button>
</div>
<section class="pregledi" id="pregledi">
<h1 class="heading"> <span> Stručno, brzo i povoljno! </span> </h1>
<h2 class="heading2"> <span>Izdvojeni pregledi</span></h3>
<div class="box-container">
<div class="box">
<div class="containerslike">
<img src="pexels-pixabay-262524.jpg" class="izborna">
<div class="overlay">
<a href="https://www.vivamed.hr/usluge/pregledi" class="ikona">
<i class="fa-solid fa-magnifying-glass"></i>
</a>
</div>
</div>
<h3>Pregled sportaša</h3>
<p>Rekreativci, amateri, profesionalci</p>
<button class="bn111" id="bn111"> Opširnije<i class="fa-solid fa-arrow-right"></i></button>
</div>
<div class="box">
<div class="containerslike">
<img src="delivery-driver-smiling-camera-his-van_13339-235836.jpg" class="izborna">
<div class="overlay">
<a href="https://www.vivamed.hr/usluge/pregledi" class="ikona">
<i class="fa-solid fa-magnifying-glass"></i>
</a>
</div>
</div>
<h3>Pregled vozača</h3>
<p>Sve vrste kategorija i pregleda</p>
<button class="bn111" id="bn111"> Opširnije<i class="fa-solid fa-arrow-right"></i></button>
</div>
<div class="box">
<div class="containerslike">
<img src="happy-graduate-woman-mantle-rejoicing-laughing-smiling_176420-14226.webp" class="izborna">
<div class="overlay">
<a href="https://www.vivamed.hr/usluge/pregledi" class="ikona">
<i class="fa-solid fa-magnifying-glass"></i>
</a>
</div>
</div>
<h3>Učenici i studenti</h3>
<p>Upisi u srednje škole, fakultete i druge akadamske ustanove</p>
<button class="bn111" id="bn111"> Opširnije<i class="fa-solid fa-arrow-right"></i></button>
</div>
<div class="podnopregled">
<button class="bn112" id="bn112"> Svi pregledi<i class="fa-solid fa-arrow-right"></i></button>
</div>
</div>
</section>
<!--
-->
<div class="infodiv">
<div class="row noMargin">
<div class="one">
<p>Radno vrijeme<br>
ponedjeljak 07 - 15
utorak 07 - 18
srijeda 07 - 14
četvrtak 07 - 14
petak 07 - 14
i prema dogovoru </p>
</div>
<div class="two">
<p>Adresa<br>
Krešićeva ul. 32/1. Kat (okretište tramvaja Borongaj)</p>
</div>
</div>
<div class="row noMargin">
<div class="three">
<p>Email<br>
info#vivamed.hr</p>
</div>
<div class="four">
<p>Telefon<br>
+385 1 233 55 00</p>
</div>
</div>
</div>
</body>
</html>
I've been coding a website in html,css and used some javascript scripts to do it. It is a medical website and so far I've done a lot to the main page which is my main problem here. I am self-taught and all the paddings, margins and screen-fits that I've coded into it are were actually applying only to the screen size that is on my laptop, and not others. I've tested this by uploading the files to InfintyFree and making it online just for the sake of testing it on other screens, and what happens is that all the content is scattered around the screen. I've put some pictures to show how it looks in comparison with my laptop, other laptop that I have and my phone. Also I've put the html and css code if you can check it out and see where I screwed up and just point me to the core because I really cannot comprehend what is going on.
Thank in advance, and sorry if there was a question like this before, because I haven't found one.[][]
I have tried putting the *{} and changing properties with it, in the body{}, height, width, overflow, padding, margins, Media only screen, everything. Still, everything fixed but only on my laptop on which it was built.
https://sagarj2021.github.io/first-website/
This is my website but it only open fullscreen in destop of my laptop. It does not open in fullscreen in smartphones destop as well as in normal search. (Actully in smartphone right side is 50% of white blank color). I dont know how to fix this issue..
I have given my code also,
so please can you help mi ?
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
.hero {
height: 100vh;
width: 100%;
background-color: black;
background-size: cover;
background-position: center;
}
nav {
display: flex;
align-items: center;
justify-content: space-between;
padding-top: 45px;
padding-left: 8%;
padding-right: 8%;
}
.logo {
color: white;
font-size: 35px;
letter-spacing: 1px;
cursor: pointer;
}
span {
color: red;
}
nav ul li {
list-style-type: none;
display: inline-block;
padding: 10px 25px;
}
nav ul li a {
color: white;
text-decoration: none;
font-weight: bold;
text-transform: capitalize;
}
nav ul li a:hover {
color: red;
transition: .4s;
}
.btn {
background-color: red;
color: white;
text-decoration: none;
border: 2px solid transparent;
font-weight: bold;
padding: 10px 25px;
border-radius: 30px;
transition: transform .4s;
}
.btn:hover {
transform: scale(1.2);
}
.content {
position: absolute;
top: 50%;
left: 8%;
transform: translateY(-50%);
}
h1 {
color: white;
margin: 20px 0px 20px;
font-size: 75px;
}
h3 {
color: white;
font-size: 25px;
margin-bottom: 50px;
}
h4 {
color: #fcfc;
letter-spacing: 2px;
font-size: 20px;
}
.newslatter form {
width: 380px;
max-width: 100%;
position: relative;
}
.newslatter form input:first-child {
display: inline-block;
width: 100%;
padding: 14px 130px 14px 15px;
border: 2px solid #f9004d;
outline: none;
border-radius: 30px;
}
.newslatter form input:last-child {
position: absolute;
display: inline-block;
outline: none;
border: none;
padding: 10px 30px;
border-radius: 30px;
background-color: #f9004d;
color: white;
box-shadow: 0px 0px 5px #000, 0px 0px 15px #858585;
top: 6px;
right: 6px;
}
.about {
width: 100%;
padding: 100px 0px;
background-color: #191919;
}
.about img {
height: auto;
width: 430px;
}
.about-text {
width: 550px;
}
.main {
width: 1130px;
max-width: 95%;
margin: 0 auto;
display: flex;
align-items: center;
justify-content: space-around;
}
.about-text h2 {
color: white;
font-size: 75px;
text-transform: capitalize;
margin-bottom: 20px;
}
.about-text h5 {
color: white;
letter-spacing: 2px;
font-size: 22px;
margin-bottom: 25px;
text-transform: capitalize;
}
.about-text p {
color: #fcfc;
letter-spacing: 1px;
line-height: 28px;
font-size: 18px;
margin-bottom: 45px;
}
button {
background-color: #f9004d;
color: white;
text-decoration: none;
border: 2px solid transparent;
font-weight: bold;
padding: 13px 30px;
border-radius: 30px;
transition: .4s;
}
button:hover {
background-color: transparent;
border: 2px solid #f9004d;
cursor: pointer;
}
.service {
background: #101010;
width: 100%;
padding: 100px 0px;
}
.title h2 {
color: white;
font-size: 75px;
width: 1130px;
margin: 30px auto;
text-align: center;
}
.box {
display: flex;
justify-content: center;
align-items: center;
min-height: 400px;
}
.card {
height: 365px;
width: 335px;
padding: 20px 35px;
background: #191919;
border-radius: 20px;
margin: 15px;
position: relative;
overflow: hidden;
text-align: center;
}
.card i {
font-size: 50px;
display: block;
text-align: center;
margin: 25px 0px;
color: #f9004d;
}
h5 {
color: white;
font-size: 23px;
margin-bottom: 15px;
}
.pra p {
color: #fcfc;
font-size: 16px;
line-height: 27px;
margin-bottom: 25px;
}
.card .button {
background-color: #f9004d;
color: white;
text-decoration: none;
border: 2px solid transparent;
font-weight: bold;
padding: 9px 22px;
border-radius: 30px;
transition: .4s;
}
.card .button:hover {
background-color: transparent;
border: 2px solid #f9004d;
cursor: pointer;
}
.contact-me {
width: 100%;
height: 290px;
background: #191919;
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
}
.contact-me p {
color: white;
font-size: 30px;
font-weight: bold;
margin-bottom: 25px;
}
.contact-me .button-two {
background-color: #f9004d;
color: white;
text-decoration: none;
border: 2px solid transparent;
font-weight: bold;
padding: 13px 30px;
border-radius: 30px;
transition: .4s;
}
.contact-me .button-two:hover {
background-color: transparent;
border: 2px solid #f9004d;
cursor: pointer;
}
footer {
position: relative;
width: 100%;
height: 400px;
background: #101010;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
footer p:nth-child(1) {
font-size: 30px;
color: white;
margin-bottom: 20px;
font-weight: bold;
}
footer p:nth-child(2) {
color: white;
font-size: 17px;
width: 500px;
text-align: center;
line-height: 26px;
}
.social {
display: flex;
}
.social a {
width: 45px;
height: 45px;
display: flex;
align-items: center;
justify-content: center;
background: #f9004d;
border-radius: 50%;
margin: 22px 10px;
color: white;
text-decoration: none;
font-size: 20px;
}
.social a:hover {
transform: scale(1.3);
transition: .3s;
}
.end {
position: absolute;
color: #f9004d;
bottom: 35px;
font-size: 14px;
}
<!--Sagar personal website-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="personalprofile.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
<script src="https://kit.fontawesome.com/34d51c031e.js" crossorigin="anonymous"></script>
<title>Personal website</title>
</head>
<body>
<div class="hero">
<nav>
<h2 class="logo">Portfo<span>lio</span></h2>
<ul>
<li>Home</li>
<li>About</li>
<li>Gallery</li>
<li>Contact</li>
</ul>
Blog
</nav>
<div class="content">
<h4>hello, my name is</h4>
<h1>Sagar<span>Jadhav</span></h1>
<h3>I'm a Web Developer.</h3>
<div class="newslatter">
<form action="">
<input type="email" name="email" id="mail" placeholder="Enter Your Email">
<input type="submit" name="submit" value="Let start">
</form>
</div>
</div>
</div>
<!---About section start-->
<section class="about">
<div class="main">
<img src="#" alt="">
<div class="about-text">
<h2>About Me</h2>
<h5>Developer & Designer</h5>
<p>
I am a front-end web developer. I can provide clean code and pixel perfect design. I also make the website more & more interactive with web animations. I can provide clean code and pixel perfect design. I also make the website more & more interactive
with web animations. A responsive design makes your website accessible to all users, regardless of their devices.
</p>
<button type="button">Let's Talk</button>
</div>
</div>
</section>
<!--Service section start-->
<div class="service">
<div class="title">
<h2>Our Services</h2>
</div>
<div class="box">
<div class="card">
<i class="fas fa-bars"></i>
<h5>Web Development</h5>
<div class="pra">
<p>Every website should be built with two primary goals: Firstly, it needs to work across all devices. Secondly, it needs to be fast as possible. </p>
<p style="text-align: center;">
<a class="button" href="#">Read More</a>
</p>
</div>
</div>
<div class="card">
<i class="fa-regular fa-user"></i>
<h5>Web Development</h5>
<div class="pra">
<p>Every website should be built with two primary goals: Firstly, it needs to work across all devices. Secondly, it needs to be fast as possible. </p>
<p style="text-align: center;">
<a class="button" href="#">Read More</a>
</p>
</div>
</div>
<div class="card">
<i class="fa-regular fa-bell"></i>
<h5>Web Development</h5>
<div class="pra">
<p>Every website should be built with two primary goals: Firstly, it needs to work across all devices. Secondly, it needs to be fast as possible. </p>
<p style="text-align: center;">
<a class="button" href="#">Read More</a>
</p>
</div>
</div>
</div>
</div>
<!--Contact Me-->
<div class="contact-me">
<p>For any help.</p>
<a class="button-two" href="#">Contact Me</a>
</div>
<!--Footer start-->
<footer>
<p>Sagar Jadhav</p>
<p>For coding and syber security related update follow my blog chennal - please click on the link below to follow me:
</p>
<div class="social">
<i class="fa-brands fa-facebook"></i>
<i class="fa-brands fa-instagram"></i>
<i class="fa-brands fa-linkedin"></i>
</div>
<p class="end">CopyRight By Sagar Jadhav</p>
</footer>
</body>
</html>
Replace this code in your code
.title h2 {
color: white;
font-size: 75px;
width: 130px;
margin: 30px auto;
text-align: center;
}
I am trying to evenly space two HTML elements (div) which both contain a list of <a> tags/links. The container width is 600px and there is a separator in between these two lists.
By running the snippet below you can see how the .dropdownSection elements are evenly sized using flex: 1. However, my problem is the separator (.sectionSeparator ) doesn't look even between the two lists?
What can I do to make it so that everything is evenly spaced, it seems like gap: 30px works well but the separator still isn't even, the second list is too close to the separator.
The reason I have used position: absolute on .dropdownLinks is so that the CSS hover transition does not push and cause other divs to be moved.
Maybe there is another way to structure this but this is my attempt.
Note: The grey boxes are to represent icons that would be there.
#container {
width: 600px;
padding-top: 20px;
}
#listSectionContainer {
display: flex;
justify-content: space-evenly;
padding: 30px;
gap: 30px;
}
.dropdownSection {
display: flex;
flex-direction: column;
justify-content: flex-start;
position: relative;
height: 210px;
flex: 1;
}
.sectionSeparator {
width: 3px;
background-color: rgba(178, 178, 178, 0.35);
border-radius: 8px;
}
.dropdownSectionTitle {
display: flex;
align-items: flex-start;
margin-right: auto;
color: #8B8792;
font-size: 20px;
}
.dropdownSectionTitle i {
height: 20px;
width: 20px;
background: grey;
margin-right: 10px;
}
.dropdownSectionTitle p {
font-weight: bold;
margin: 0;
}
.dropdownLinks {
display: flex;
flex-direction: column;
margin-top: 25px;
font-size: 18px;
padding-left: 28px;
position: absolute;
top: 20px;
}
.dropdownLinks a:not(:last-of-type) {
margin-bottom: 10px;
}
.dropdownLinks a:link {
color: #939393;
text-decoration: none;
transition: all 0.2s linear;
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
}
.dropdownLinks a:visited {
color: #939393;
text-decoration: none;
}
.dropdownLinks a:hover {
color: #7B69FE;
padding-left: 5px;
text-decoration: none;
}
.dropdownLinks a:active {
color: #939393;
text-decoration: none;
}
<div id="container">
<div id="listSectionContainer">
<div class="dropdownSection">
<div class="dropdownSectionTitle"><i class="fas fa-book-reader"></i>
<p>Getting Started</p>
</div>
<div class="dropdownLinks">
Introduction
Introduction Two
Introduction Three
Introduction Four
Introduction Five
</div>
</div>
<div class="sectionSeparator"></div>
<div class="dropdownSection">
<div class="dropdownSectionTitle"><i class="fas fa-plug"></i>
<p>Second List</p>
</div>
<div class="dropdownLinks">
Introduction
Introduction Two
Introduction Three
Introduction Four
Introduction Five
</div>
</div>
</div>
</div>
After further investigation, there is nothing wrong in your code.
As you can see in the below snippet. The sections are evenly separated from the vertical line.
I have used a border for both container and the sections to understand that clearly.
#container {
width: 600px;
padding-top: 20px;
}
#listSectionContainer {
display: flex;
justify-content: space-evenly;
padding: 30px;
gap: 30px;
border: 1px solid blue;
}
.dropdownSection {
display: flex;
flex-direction: column;
justify-content: flex-start;
position: relative;
height: 210px;
flex: 1;
border: 1px solid #f00;
}
.sectionSeparator {
width: 3px;
background-color: rgba(178, 178, 178, 0.35);
border-radius: 8px;
}
.dropdownSectionTitle {
display: flex;
align-items: flex-start;
margin-right: auto;
color: #8B8792;
font-size: 20px;
}
.dropdownSectionTitle i {
height: 20px;
width: 20px;
background: grey;
margin-right: 10px;
}
.dropdownSectionTitle p {
font-weight: bold;
margin: 0;
}
.dropdownLinks {
display: flex;
flex-direction: column;
margin-top: 25px;
font-size: 18px;
padding-left: 28px;
position: absolute;
top: 20px;
}
.dropdownLinks a:not(:last-of-type) {
margin-bottom: 10px;
}
.dropdownLinks a:link {
color: #939393;
text-decoration: none;
transition: all 0.2s linear;
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
}
.dropdownLinks a:visited {
color: #939393;
text-decoration: none;
}
.dropdownLinks a:hover {
color: #7B69FE;
padding-left: 5px;
text-decoration: none;
}
.dropdownLinks a:active {
color: #939393;
text-decoration: none;
}
<div id="container">
<div id="listSectionContainer">
<div class="dropdownSection">
<div class="dropdownSectionTitle"><i class="fas fa-book-reader"></i>
<p>Getting Started</p>
</div>
<div class="dropdownLinks">
Introduction
Introduction Two
Introduction Three
Introduction Four
Introduction Five
</div>
</div>
<div class="sectionSeparator"></div>
<div class="dropdownSection">
<div class="dropdownSectionTitle"><i class="fas fa-plug"></i>
<p>Second List</p>
</div>
<div class="dropdownLinks">
Introduction
Introduction Two
Introduction Three
Introduction Four
Introduction Five
</div>
</div>
</div>
</div>
I have created this web page using html, CSS and bootstrap, everything is okay on large and medium screen, but when I restore-down to small screen (col-12 and col-sm-12) the features and services sections blend, I tried everything I don't know how to fix it.
here is some code, I hope it is clear for you guys:
* {
padding: 0;
margin: 0;
font-family: "Lucida Fax", sans-serif;
}
body {
overflow-x: hidden;
}
.header .content-box {
background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url(img/Webz.jpeg);
background-position: center;
background-size: cover;
width: 100%;
height: 100vh;
}
.menu {
display: inline-flex;
}
.menu button {
width: 75px;
height: 35px;
}
.menu img {
width: 147px;
height: 147px;
cursor: pointer;
margin-top: 1px;
}
.menu button {
background: #ff4d73;
font-size: 16px;
color: #fff;
border: 0;
position: absolute;
right: 70px;
top: 40px;
cursor: pointer;
}
.menu button .fa {
margin-right: 7px;
}
.banner-text {
color: whitesmoke;
margin: 14%;
text-align: center;
}
.banner-text h2 {
font-size: 37px;
}
.banner-text p {
font-size: 15px;
margin: 25px;
}
.banner-text a {
border: 1px solid #ff4d73;
padding: 7px;
color: white;
text-decoration: none;
display: block;
width: 100px;
margin: auto;
background: #ff4d73;
transition: .70s;
}
.banner-text a:hover {
background: transparent;
}
.service .content-box {
background: whitesmoke;
width: 100%;
height: 100vh;
}
h1 {
text-align: center;
padding-top: 100px;
}
.service h1::after {
content: '';
background: #ff4d73;
display: block;
height: 3px;
width: 190px;
margin: 21px auto 50px;
}
.services .icon {
font-size: 37px;
margin: 21px auto;
height: 55px;
width: 55px;
border: 1px solid #ff4d73;
border-radius: 50%;
color: #ff4d73;
}
.services p {
font-size: 12px;
margin-top: 10px;
color: #777;
padding: 20px;
}
.services span {
color: #ff4d73;
}
h3 {
font-size: medium;
}
.services .col-md-3:hover {
background: #ff4d73;
cursor: pointer;
color: #fff;
box-shadow: -5px 5px 10px 0 rgba(0, 0, 0, 0.4);
transition: 0.5s;
}
.services .col-md-3:hover p {
color: #fff;
}
.services .col-md-3:hover span {
color: #fff;
}
.services .col-md-3:hover .icon {
border: 1px solid #fff;
color: #fff;
}
li {
padding-left: 35px;
}
.features .content-box {
background: white;
width: 100%;
height: 100vh;
}
.features h2 {
margin: 49px;
padding-top: 111px;
}
.features h2::after {
content: '';
background: #ff4d73;
display: block;
height: 3px;
width: 150px;
margin: 13px 7px 51px;
}
.features ul {
margin-left: 5px;
margin-top: 33px;
list-style-type: none;
}
.features ul li {
position: relative;
line-height: 33px;
font-size: 13px;
}
.features ul li::before {
content: '';
height: 7px;
width: 7px;
background: #ff4d73;
transform: rotate(45deg);
margin-right: 19px;
display: inline-block;
}
img {
height: 57%;
width: 85%;
margin-top: 29%;
}
.footer .content-box {
background: whitesmoke;
width: 100%;
height: 100vh;
}
.footer h1::after {
content: '';
background: #ff4d73;
display: block;
height: 3px;
width: 190px;
margin: 21px auto 50px;
}
.form-control {
margin: 17px;
border-radius: 0 !important;
border: none !important;
box-shadow: none !important;
}
::placeholder {
font-size: 12px;
}
.contact-form button {
border: none !important;
background: #ff4d73 !important;
box-shadow: none !important;
border-radius: 0;
margin-left: 27px;
}
.contact-info .follow {
background-color: #fff;
padding: 8px;
margin: 11px;
}
.contact-info .fa {
margin: 10px;
padding-right: 20px;
font-size: 20px;
font-weight: bold;
color: #ff4d73 !important;
}
.copyright {
text-align: center;
font-size: 15px;
}
.fa-heart-o {
color: red;
font-size: 17px;
}
.footer hr {
margin-top: 217px;
background: #ff4d73;
}
.form-group label {
display: block;
}
.features {
position: relative;
top: 100%;
}
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<title>Document</title>
</head>
<body>
<!-- Service Section -->
<section class="service d-block">
<div class="content-box">
<div class="container">
<h1>Our Services</h1>
<div class="row services d-block">
<div class="col-md-3 col-sm-12 col-12 text-center">
<div class="icon">
<i class="fa fa-renren"></i>
</div>
<h3>Brand <span>Activation</span></h3>
<p>
Subscribe to our Youtube channel to watch more videos on web development, UI design, photoshop and Digital marketing. Don't forget to press the bell icon and never miss any new video
</p>
</div>
<div class="col-md-3 col-12 text-center">
<div class="icon">
<i class="fa fa-user"></i>
</div>
<h3>Employee <span>Activity</span></h3>
<p>
Subscribe to our Youtube channel to watch more videos on web development, UI design, photoshop and Digital marketing. Don't forget to press the bell icon and never miss any new video
</p>
</div>
<div class="col-md-3 col-12 text-center">
<div class="icon">
<i class="fa fa-meetup"></i>
</div>
<h3>Event <span>Organizer</span></h3>
<p>
Subscribe to our Youtube channel to watch nmore videos on web development, UI design, photoshop and Digital marketing. Don't forget to press the bell icon and never miss any new video
</p>
</div>
<div class="col-md-3 col-12 text-center">
<div class="icon">
<i class="fa fa-video-camera"></i>
</div>
<h3>Video <span>Production</span></h3>
<p>
Subscribe to our Youtube channel to watch nmore videos on web development, UI design, photoshop and Digital marketing. Don't forget to press the bell icon and never miss any new video
</p>
</div>
</div>
</div>
</div>
</section>
<!-- Features Section -->
<section class="features d-block">
<div class="content-box">
<div class="container">
<div class="row">
<div class="col-md-6 col-sm-12 col-12">
<h2>Features Are</h2>
<ul>
<li>Some Text Some Text Some Text Some Text.</li>
<li>Some Text Some Text Some Text Some Text. </li>
<li>Some Text Some Text Some Text Some Text Some Text.</li>
<li>Some Text Some Text Some Text Some Text Some Text.</li>
<li>Some Text Some Text Some Text Some Text.</li>
</ul>
</div>
<div class="col-md-6 col-sm-12 col-12">
<img src="img/Webz2.jpeg" alt="Picture">
</div>
</div>
</div>
</div>
</section>
</body>
</html>
Your content is bigger than 100vh, but you are limiting the container to that size. That is the overlapping reason.
.content-box {
height: 100vh;
}
I'm designing a part of a website that is supposed to have no scrolls on it. Very simple design and it works very well in Chrome and FF.
But when I test it in IE and start to write in a textbox, the content jumps up and seems to center the screen on that input and I have no idea why.
See this JSFIDDLE
This is my HTML:
<div class="container">
<div>
<h1>
Enter your name
</h1>
</div>
<div>
<p>
Enter your name here!
</p>
</div>
<div class="input-container">
<input type="text" id="msisdn" />
</div>
<div class="button-container">
SUBMIT NAME
</div>
</div>
And this is my CSS:
html, body {
width: 100%;
height: 100%;
max-height: 100%;
overflow: hidden;
}
.container {
width: 40%;
display: block;
text-align: center;
margin: 0 auto;
}
body {
background: #0f5082;
color: #FFF;
}
h1 {
margin-top: 20%;
font-size: 56px;
font-weight: bold;
color: #FFF;
}
p {
margin-top: 20px;
padding-left: 15%;
padding-right: 15%;
font-size: 26px;
word-spacing: 0.1em;
font-weight: 300;
color: #FFF;
}
.caps {
text-transform: uppercase;
}
.input-container > input {
background: transparent;
margin-top: 40px;
padding-top: 5px;
padding-bottom: 6px;
border: 1px solid #FFF;
-ms-border-radius: 5px;
border-radius: 5px;
font-size: 24px;
color: #FFF;
text-align: center;
}
.button-container {
margin-top: 40px;
text-align: center;
}
.button {
padding: 15px 20px;
text-decoration: none;
color: #FFF;
font-size: 20px;
background-color: #FA8845;
-ms-border-radius: 5px;
border-radius: 5px;
letter-spacing: 0.03em;
}
.button:hover {
color: #0f5082;
-webkit-transition: all ease 0.2s;
-moz-transition: all ease 0.2s;
-ms-transition: all ease 0.2s;
-o-transition: all ease 0.2s;
transition: all ease 0.2s;
}
What I want is simple, have the screen stay just as it was before I typed in the textbox. Does anyone know, first off, why it does this, and secondly how I can avoid it?
Thanks in advance!
Martin Johansson
Issue is due to
h1
{
margin-top: 20%;
}
Replace this as below
h1
{
margin-top: 90px;
}
I hope it will resolve it.!