Why am i getting blank space at the bottom when height increases? - css

Currently, I am trying to make my site responsive.But even though now it works well for (1440x760) but when the height increases i get a blank position at the end.
Why is it appearing and how can i get rid of that here and in future instances.
Live Site Link - https://mustakabsarkhan.github.io/ip-address-tracker/
SCSS Code -
html{
box-sizing: border-box;
font-size: 100%;
};
*,
*::before,
*::after{
box-sizing: inherit;
margin: 0;
padding: 0;
};
body{
font-family: 'Open Sans', sans-serif;
min-height: 100vh;
font-family: 'Rubik', sans-serif;
background: url(../../images/pattern-bg.png);
};
.main-body{
display: flex;
flex-direction: column;
text-align: center;
& .ip-header{
margin-top: 2%;
color: p.color(simple-white);
font-size: p.pxtovw(35);
};
& .search-bar{
display: flex;
justify-content: center;
text-align: left;
& >input{
padding-left: 20px;
};
& #searchbox{
height: p.pxtovh(50);
width: p.pxtovw(490);
//margin-right: 6.3%;
margin-left: 4%;
border-radius: 13px 0 0 13px;
border: none;
margin-top: 1%;
};
& .searchbox-button{
margin-top: 1%;
height: p.pxtovh(50);
width: p.pxtovw(50);
background-color: black;
border: none;
border-radius: 0 13px 13px 0;
margin-right: 55px;
};
& button:active {
opacity: 0.7;
transform: translateY(1px);
border: inherit;
border: 2px solid black;
};
};
& .main-container{
width: 100%;
& .content-bar{
background: p.color(simple-white);
display: flex;
border-radius: 15px;
justify-content: center;
width: 74%;
margin-left: 13%;
padding: 2%;
text-align: left;
margin-top: 2%;
gap:3%;
& .line{
border-left: p.pxtovw(2) solid p.color(dark-grey);
height: p.pxtovh(90);
margin-top: 1%;
};
& >div>label{
font-size: p.pxtovw(14);
color: p.color(dark-grey);
};
& >div>p{
font-size: p.pxtovw(24);
};
};
& .sub-content-bar{
display: flex;
flex-direction: column;
& .sub-content-bar-content{
z-index: 9;
position: absolute;
display: flex;
justify-content: center;
gap:10%;
text-align: center;
margin-top: 1%;
padding: 1%;
background-color: p.color(simple-white);
width: 50.6%;
margin-left: 24.5%;
border-radius: 15px;
& .flags>img{
margin-top: 5px;
width: p.pxtovw(64);
};
& >div>label{
font-size: p.pxtovw(14);
color: p.color(dark-grey);
};
& >div>p{
font-size: p.pxtovw(24);
};
};
};
& #map {
z-index: 2;
position: relative;
height: calc(656px - 20vw);
width: 100%;
margin-top: 4.6%;
};
};
};

add this to your .main-body class
justify-content: space-between;
min-height: 100vh;

Changing map height with vh has helped to solved the issue. Previously, due to using height: calc(656px - 20vw) the map couldn't get bigger than 656px.
Also Thanks to #AdamUK73 for pointing out the exact reason.
Solution Code-
& #map {
z-index: 2;
position: relative;
height: calc(p.pxtovh(656) - 20vw);
width: 100%;
margin-top: 4.6%;
};

Related

React Sidebar Goes Behind Background Image, but Over Navbar Title

Two issues-
I built a react sidebar, and for some reason whenever toggling it, the bar is behind the page's background image. I tried putting z-index: -1; on the background image, but then the image disappears (though the side bar finally shows again.) I have messed around with "position", with no success either. How can I get my sidebar to go over my background image?
The other issue is that whenever toggling the sidebar, it cover the navbar's title. Any suggestions on how to get my navbar's title to move to the side when the sidebar is being toggled?
enter image description here
enter image description here
.navbar {
align-items: center;
background-color: #060b26;
color: white;
display: flex;
height: 80px;
justify-content: start;
text-align: right;
}
.title {
margin-left: 20px;
}
.menu-bars {
margin-left: 2rem;
font-size: 2rem;
background: none;
}
.nav-menu {
background-color: #060b26;
width: 250px;
height: 100vh;
display: flex;
justify-content: center;
position: fixed;
top: 0;
left: -100%;
transition: 850ms;
}
.nav-menu.active {
left: 0;
position: absolute;
transition: 350ms;
}
.nav-text {
display: flex;
justify-content: start;
align-items: center;
padding: 8px 0px 8px 16px;
list-style: none;
height: 60px;
}
.nav-text a {
text-decoration: none;
color: #f5f5f5;
font-size: 18px;
width: 95%;
height: 100%;
display: flex;
align-items: center;
padding: 0 16px;
border-radius: 4px;
}
.nav-text a:hover {
background-color: #1a83ff;
}
.nav-menu-items {
width: 100%;
}
.navbar-toggle {
align-items: center;
background-color: #060b26;
display: flex;
height: 80px;
justify-content: start;
position: absolute;
width: 100%;
}
span {
margin-left: 16px;
}
.backgroundImage {
background-image: url('assets/dog.jpg');
background-repeat: no-repeat;
background-size: 100% 100%;
filter: blur(2px);
height: 100vh;
width: 100%;
}
.dashboardButton {
background: linear-gradient(
#fd585c,
#ec7278,
#ff5b69
);
border-radius: 8px;
color: #f5f5f5;
display: grid;
font-style: "Poppins", sans-serif;
height: 80px;
left: 43%;
letter-spacing: 3px;
margin: auto;
place-items: center;
position: absolute;
text-decoration: none;
top: 55%;
width: 200px;
}
.welcomeHeader {
color: #fd585c;
display: center;
font-size: 375%;
left: 25%;
position: absolute;
top: 35%
}
.welcomeDescription {
color: #f5f5f5;
font-size: 125%;
left: 20%;
position: absolute;
top: 47%;
}
I ended up putting:
backgroundImage {
z-index: 1;
}
nav-menu.active {
z-index: 2;
}
That solved the issue!

Border-Radius & Overflow: Hidden

I seem to be having a weird problem when using border-radius and overflow: hidden together, please see the picture for my problem.
As you can see in the bottom right the image doesn't expand to the very edge of the div and a little curve is visible, any help will be much appreciated.
I also have a live version here, problem can be seen near the bottom of the page: http://hasky.infinityfreeapp.com/
Image
.content__card {
position: relative;
margin: 1em 0;
width: 80em;
max-width: 80%;
min-height: 35em;
border-radius: 0.8em;
display: flex;
flex-flow: row wrap;
justify-content: space-between;
align-items: center;
overflow: hidden;
border: none;
}
.content__card .info {
text-align: left;
margin: 1.5em 3em;
height: auto;
}
.content__card .info h2 {
font-family: "DemiBold", sans-serif;
}
.content__card .info p {
font-size: clamp(1rem, 2vw, 1.4rem);
font-family: "Medium", sans-serif;
margin: 1.5em 0;
}
.content__card a {
position: absolute;
bottom: 2em;
border-radius: 0.8em;
background: #fff;
color: #111;
text-decoration: none;
font-weight: 700;
z-index: 3;
padding: 0.6em 1.8em;
font-size: clamp(1rem, 3vw, 1.4rem);
font-family: "Medium", sans-serif;
}
.content__card img {
position: absolute;
right: 0;
bottom: 0;
width: 30em;
}
.content__card__three {
background: #7D44FD;
color: #fff;
}
<div class="content__card content__card__three span-2">
<div class="info">
<h2>Sekite mūsu</h2>
<h2>Youtube kanalą!</h2>
Youtube
</div>
<img src="https://i.imgur.com/5ZXj6fP.png">
</div>
I'm not sure what your problem is exactly, but this is the solution I can provide depending on what I understood.
added the basic styling and also remove some unnecessary code.
*,
*::before,
*::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
background: #000;
}
.content__card {
position: relative;
margin: 1em 0;
max-width: 90%;
min-height: 35em;
border-radius: 0.8em;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
overflow: hidden;
}
.content__card .info {
text-align: left;
margin: 1.5em 3em;
width: 20rem;
}
.content__card .info h2 {
font-family: "DemiBold", sans-serif;
}
.content__card .info p {
font-size: clamp(1rem, 2vw, 1.4rem);
font-family: "Medium", sans-serif;
margin: 1.5em 0;
}
.content__card a {
position: absolute;
bottom: 2em;
border-radius: 0.8em;
background: #fff;
color: #111;
text-decoration: none;
font-weight: 700;
z-index: 3;
padding: 0.6em 1.8em;
font-size: clamp(1rem, 3vw, 1.4rem);
font-family: "Medium", sans-serif;
}
.content__card img {
position: absolute;
right: 0;
bottom: 0;
width: 30em;
}
.content__card__three {
background: #7d44fd;
color: #fff;
}
<div class="content__card content__card__three span-2">
<div class="info">
<h2>Sekite mūsu</h2>
<h2>Youtube kanalą!</h2>
Youtube
</div>
<img src="https://i.imgur.com/5ZXj6fP.png">
</div>

How do I move/align the right box component closer to the left?

There were recently 3 component boxes, but the middle one was not needed anymore, so I just deleted it.
Yet, when I deleted the middlebox(blue color), the 2 remaining boxes became too far apart and it doesn't make it look nice.
How do I move the far-right red box closer to the middle to align with the yellow box?
code
#import '../../scss/variables.scss';
.dashboard {
&__module {
padding: 20px 20px 50px 20px;
flex-basis: 30%;
flex-grow: 0;
color: $white;
&:nth-child(1) {
background-color: $orange;
}
&:nth-child(2) {
background-color: $red;
}
&:nth-child(3) {
background-color: $blue;
}
a {
color: $white;
}
}
&__module_header {
border-bottom: 2px solid white;
padding-bottom: 5px;
display: flex;
}
&__module_title {
display: inline-flex;
flex: 1 0;
}
&__module_title_link {
justify-self: flex-end;
font-weight: bold;
}
&__module_row {
border-bottom: 1px solid white;
padding-bottom: 5px;
padding-top: 15px;
padding-bottom: 15px;
}
&__module_stat_container {
display: flex;
justify-content: flex-start;
&.primary {
font-size: 18px;
.dashboard__module_stat {
font-weight: bold;
}
}
}
&__module_stat {
width: 20px;
text-align: right;
margin-right: 10px;
}
&__module_date {
width: 50px;
text-align: right;
margin-right: 10px;
font-weight: bold;
}
&__module_subtext {
font-size: 14px;
display: block;
}
}
#media screen and (max-width:920px){
.dashboard__modules_container {
display:block !important;
width: 100%;
.dashboard {
&__module {
padding: 20px 20px 50px 20px;
margin-bottom: 20px;
width: 100%;
position: relative;
display: block;
flex-basis: 100%;
flex-grow: 0;
color: $white;
}
}
}
}
SOLUTION:
switch
justify-content: space-between;
to
justify-content: space-evenly;

Custom Checkbox without label [duplicate]

This question already has answers here:
What are the various ways to hide a <div>?
(5 answers)
Can I have an onclick effect in CSS?
(14 answers)
Closed 2 years ago.
I have an a element that acts like a toggle button :
var container = document.getElementsByClassName("favorite");
for (var i = 0; i < container.length; i++) {
//For each element in the container array, add an onclick event.
container[i].onclick = function(event) {
this.classList.toggle('selected');
}
}
body {
background-color: #04246A;
}
.container {
position: relative;
width: 204px;
max-width: 204px;
height: 82px;
max-height: 82px;
padding: 24px;
background: #fff;
display: flex;
flex-direction: column;
justify-content: space-between;
box-sizing: border-box;
color: black;
list-style: none;
border: 2px solid black;
}
.container .favorite {
position: absolute;
top: 10px;
right: 10px;
width: 40px;
height: 40px;
display: flex;
border-radius: 50%;
cursor: pointer;
}
.container .favorite:hover {
background: #D9DEEA;
}
.container .favorite::after {
z-index: 2;
position: relative;
margin: auto;
height: 20px;
content: url("https://img.icons8.com/ios/16/000000/star.png");
}
.container .favorite.selected::after {
content: url("https://img.icons8.com/ios-filled/16/000000/star.png");
}
.container dl {
margin: 0;
}
.container dl dt {
display: block;
font-size: 12px;
color: #6B7790;
}
.container dl dd {
margin: 0;
font-weight: normal;
color: #04246A;
}
<div class="container">
<a class="favorite"></a>
<dl>
<dt>Ref</dt>
<dd>XXX123</dd>
</dl>
</div>
I want to transform it to a checkbox, but the solutions I find are for a checkbox with a label, I only want to use the checkbox in my html without the label or some additional div, this is what I tried :
body {
background-color: #04246A;
}
.container {
position: relative;
width: 204px;
max-width: 204px;
height: 82px;
max-height: 82px;
padding: 24px;
background: #fff;
display: flex;
flex-direction: column;
justify-content: space-between;
box-sizing: border-box;
color: black;
list-style: none;
border: 2px solid black;
}
input[type="checkbox"]{
height: 20px;
width: 20px;
position: absolute;
opacity: 1;
margin: auto;
height: 20px;
cursor: pointer;
top: 10px;
right: 10px;
}
input[type="checkbox"]::after{
content: url("https://img.icons8.com/ios/16/000000/star.png");
position: absolute;
top: 0;
left: 0;
border-radius: 50%;
margin: auto;
height: 20px;
width: 20px;
pointer-events: none;
}
input[type="checkbox"]:checked:after {
content: url("https://img.icons8.com/ios-filled/16/000000/star.png");
}
input[type="checkbox"]:hover:after{
background: #D9DEEA;
}
.container dl {
margin: 0;
}
.container dl dt {
display: block;
font-size: 12px;
color: #6B7790;
}
.container dl dd {
margin: 0;
font-weight: normal;
color: #04246A;
}
<div class="container">
<input type="checkbox" />
<dl>
<dt>Ref</dt>
<dd>XXX123</dd>
</dl>
</div>
Which doesn't look good.
How can I fix this ? and thanks in advance.
You can add appearance:none to remove to checkbox appearance and set fixed height/width to checkbox and :after, changing :after to flex allows you to center the background.
body {
background-color: #04246A;
}
.container {
position: relative;
width: 204px;
max-width: 204px;
height: 82px;
max-height: 82px;
padding: 24px;
background: #fff;
display: flex;
flex-direction: column;
justify-content: space-between;
box-sizing: border-box;
color: black;
list-style: none;
border: 2px solid black;
}
input[type="checkbox"]{
height: 40px;
width: 40px;
position: absolute;
opacity: 1;
margin: auto;
cursor: pointer;
top: 10px;
right: 10px;
appearance: none;
outline: none;
}
input[type="checkbox"]::after{
content: url("https://img.icons8.com/ios/16/000000/star.png");
position: absolute;
top: 0;
left: 0;
border-radius: 50%;
margin: auto;
height: 40px;
width: 40px;
pointer-events: none;
display: flex;
justify-content: center;
align-items: center;
}
input[type="checkbox"]:checked:after {
content: url("https://img.icons8.com/ios-filled/16/000000/star.png");
}
input[type="checkbox"]:hover:after{
background: #D9DEEA;
}
.container dl {
margin: 0;
}
.container dl dt {
display: block;
font-size: 12px;
color: #6B7790;
}
.container dl dd {
margin: 0;
font-weight: normal;
color: #04246A;
}
<div class="container">
<input type="checkbox" />
<dl>
<dt>Ref</dt>
<dd>XXX123</dd>
</dl>
</div>

page is not working properly on small screen

My page is working properly on bigger screen size devices but on mobile devices it is not working properly. please help
https://codesandbox.io/s/ships-q64g6?file=/src/App.js
Try this CSS
* {
box-sizing: border-box
}
.App {
font-family: sans-serif;
text-align: center;
width: 100%;
height: 100%;
background-color: #00171f;
}
.App h4 {
font-size: 25.5px;
text-align: center;
color: whitesmoke;
}
.container {
display: flex;
flex-wrap: wrap;
flex-direction: column;
display: inline-block;
width: 100%;
}
.container ul {
width: 100%;
max-width: 800px;
padding: 10px;
}
.container li {
width: 100%;
list-style: none;
font-size: 20px;
font-weight: 1.5em;
}
.container img {
width: 100%;
height: 500px;
}
.container .name {
max-width: 660px;
width: 100%;
height: 20px;
text-align: left;
color: #57e1ed;
}
.container .port {
margin-top: -20px;
font-size: 20px;
text-align: right;
color: #57e1ed;
}

Resources