div position problem i want this hello text under the pricing section - html

div position problem i want this hello text under the pricing section`
please help me to solve this problem
i am using different div but it still show me same result
div position problem i want this hello text under the pricing sectiondiv position problem i want this hello text under the pricing section div position problem i want this hello text under the pricing section
#import url("https://fonts.googleapis.com/css2?family=Fira+Sans+Condensed:wght#100&family=Poppins:wght#300;400;500;600&family=Roboto:wght#300&family=Silkscreen&display=swap");
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande",
"Lucida Sans Unicode", Geneva, Verdana, sans-serif;
}
body {
background: #161c41;
}
.gallery {
position: relative;
float: left;
/* display: flex; */
}
.cardBx {
width: 100%;
/* min-height: 100%; */
/* display: flex; */
/* flex-wrap: wrap; */
justify-content: center;
align-items: center;
float: left;
}
.cardBx .card {
width: 280px;
border-radius: 10px;
margin: 20px 40px;
background: #1b2141;
overflow: hidden;
}
.cardBx .card img {
width: 100%;
height: 250px;
object-fit: cover;
}
.cardBx .card .content {
padding: 10px;
}
.cardBx .card .content h4 {
color: white;
margin: 15px 0;
}
.cardBx .card .progress-line {
position: relative;
height: 10px;
width: 100%;
background-color: #35407e;
margin-bottom: 15px;
border-radius: 10px;
transform: scaleX(0);
transform-origin: left;
animation: animate 1s cubic-bezier(1, 0, 0.5, 1) forwards;
}
.cardBx .card .progress-line span {
position: absolute;
height: 100%;
width: 80%;
border-radius: 10px;
background: #1aeeef;
transform: scaleX(0);
transform-origin: left;
animation: animate 1s cubic-bezier(1, 0, 0.5, 1) forwards;
}
#keyframes animate {
100% {
transform: scaleX(1);
}
}
.cardBx .card .info {
border-top: 2px solid #35407e;
padding: 5px;
display: flex;
justify-content: space-between;
align-items: center;
}
.cardBx .card .info p {
font-size: 1em;
color: white;
}
.cardBx .card .info p span {
color: #1aeeef;
}
.cardBx .card .content .info a {
display: inline-block;
padding: 10px 20px;
margin: 20px 0;
border: 1px solid #1aeeef;
text-decoration: none;
font-weight: 700;
border-radius: 5px;
color: white;
letter-spacing: 1px;
}
.cardBx .card .content .info a:hover {
background: #1aeeef;
border: none;
color: #050e2d;
box-shadow: 0 0 10px #1aeeef;
}
.cardBx {
display: flex;
justify-content: center;
align-items: center;
}
/* ////nav */
nav {
display: flex;
align-items: center;
justify-content: space-between;
background: #05123d;
height: 70px;
text-decoration: none;
}
.logo {
width: 160px;
margin-right: 45px;
margin-left: 10px;
}
.nav-left {
display: flex;
align-items: center;
}
.nav-left ul li {
font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;
cursor: pointer;
list-style: none;
margin-left: 70px;
text-decoration: none;
display: inline-block;
}
.nav-left ul li a {
color: rgb(255, 255, 255);
font-size: 25px;
font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande",
"Lucida Sans Unicode", Geneva, Verdana, sans-serif;
text-decoration: none;
padding: 1rem;
}
/* ===========hjbhedbfj======== */
/* html,
body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
font-family: "Helvetica", sans-serif;
} */
img {
max-width: 100%;
}
.slider-container {
height: 600px;
width: 100%;
border-top: 2px solid #1aeeef;
border-bottom: 2px solid #1aeeef;
position: relative;
overflow: hidden;
text-align: center;
}
.menu {
position: absolute;
left: 0;
z-index: 900;
width: 100%;
bottom: 0;
}
.menu label {
cursor: pointer;
display: inline-block;
width: 16px;
height: 16px;
background: #fff;
border-radius: 50px;
margin: 0 0.2em 1em;
&:hover {
background: red;
}
}
.slide {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 100%;
z-index: 10;
padding: 8em 1em 0;
background-size: cover;
background-position: 50% 50%;
transition: left 0s 0.75s;
}
[id^="slide"]:checked + .slide {
left: 0;
z-index: 100;
transition: left 0.65s ease-out;
}
.slide-1 {
background-image: url("https://wallpaperaccess.com/full/625497.jpg");
}
.slide-2 {
background-image: url("https://freefiremobile-a.akamaihd.net/common/web_event/official2.ff.garena.all/img/20228/29bfa3738921a9e9d096f5c4cdfaf297.jpg");
}
.slide-3 {
background-image: url("https://wallpaperaccess.com/full/625497.jpg");
}
/* ==========footer========== */
.bddiv {
display: inline-block;
vertical-align: middle;
color: #1aeeef;
}
<!DOCTYPE html>
<html lang="en">
<head>
<style>
#import url("https://fonts.googleapis.com/css2?family=Poppins:wght#200&display=swap");
</style>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- css link -->
<link rel="stylesheet" href="./shop.css" />
<!-- <link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta2/css/all.min.css"
/> -->
<title>Shop</title>
</head>
<body>
<nav>
<div class="nav-left">
<img src="./ggh.svg" class="logo" />
<ul>
<li>Home</li>
<li><a>Turnament</a></li>
<li><a>News</a></li>
<li class="shopname"><a>Shop</a></li>
<li><a>About us</a></li>
</ul>
</nav>
<main>
<?php
include './slider/slider.php' ?>
<?php
include 'shopdb.php';
$sql="SELECT * from shop_table";
$query=mysqli_query($conn,$sql);
while($info=mysqli_fetch_array($query)){
?>
<div class="gallery">
<div class="cardBx">
<div class="card" data-item="pc">
<img src="shop/<?php echo $info['imageup']; ?>" alt="loding">
<div class="content">
<h4><?php echo $info['gamename']; ?></h4>
<div class="progress-line"><span></span>
</div>
<div class="info">
<p>pricing<br /><span> <?php echo $info['price']; ?></span></p>
Buy Now
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
<div class="bddiv"> hello</div>
</main>
</body>
</html>
`

the float made this problem if you want to put your price section in the right , remove float and use this code:
.gallery {
position: relative;
}
.cardBx {
width: 100%;
justify-content: start;
align-items: center;
}

Please Try This
Just add clear:both as style in <div> containing "Hello" text
<div class="bddiv" style="clear:both;"> hello</div>

I just increase the padding-top and padding-left and it works fine, Here's the code of the CSS I changed.
.bddiv {
padding-top: 230px;
padding-left: 60px;
color: #1aeeef;
}
Just change the bddiv CSS. The Html code is working good

Related

How to change the content of grid items without using 'vw' units?

I'm quite new to building grid layouts. I'm trying to change the dimensions of the content in the grid elements via pixels, percentages, but they remain the same, only viewport units work. There are grid-template-columns and grid-template-rows allow to increase the size of the content. I'm trying to make the top two elements: logo and menu hamburger, get bigger and almost adjacent to each other. And, I noticed that if reduce the height of the visible area of the screen, then the elements increase. Why can't I "simply" increase these two elements without doing this is beyond me? Below is a piece of code and one screenshot of what the mobile version looks like now, and how it should. Please check what is wrong.
* {
padding:0;
margin:0;
box-sizing: border-box;
}
body {
font-family: "Segoe UI", sans-serif;
height: 100vh;
}
.container {
display: grid;
grid-template-columns: repeat(10, 10%);
grid-template-rows: repeat(20, 5%);
height: 100%;
box-sizing: border-box;
}
.logo {
grid-column: 1 / 10;
grid-row: 1 / 4;
background-color: #f8f8f8;
display: flex;
align-items: center;
padding-left: 3%;
}
.logo img {
max-width: 100%;
height: auto;
}
.header {
grid-column: 10 / 11;
grid-row: 1 / 4;
background-color: #f8f8f8;
display: flex;
justify-content: center;
align-items: center;
}
.gsi {
background-color: #1b8183;
grid-column: 1 / 6;
grid-row: 8 / 17;
z-index: 1;
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: start;
padding-left: 7%;
}
/* Text */
.gsi h1 {
font-family: 'TT Norms', Helvetica Now, Helvetica, Arial, sans-serif;
font-weight: normal;
font-style: normal;
font-size: 3vw;
color: #ffffff;
white-space: nowrap;
}
.gsi h1::after {
display: inline-block;
vertical-align: middle;
content: "";
height: 1px;
position: relative;
background-color: #ffffff;
width: 4vw;
right: -0.5em;
}
.gsi p {
font-family: 'TT Norms', Helvetica Now, Helvetica, Arial, sans-serif;
font-weight: normal;
font-style: normal;
font-size: 2vw;
color: #ffffff;
margin: 0;
white-space: nowrap;
}
.button {
font-family: 'TT Norms', Helvetica Now, Helvetica, Arial, sans-serif;
font-size: 1.5vw;
background-color: rgba(28, 28, 28, 0);
border: 2px solid #fff;
border-radius: 3em / 3em;
color: white;
padding: 1% 7.5%;
text-align: center;
text-decoration: none;
margin: 4px 2px;
cursor: pointer;
}
.pillar {
grid-column: 5 / 11;
grid-row: 4 / 21;
}
.pillar img {
width: 100%;
height: 100%;
object-fit: cover;
}
/* Anything related to hamburger */
.logo-text a:active,
.logo-text a:hover,
.logo-text a {
text-decoration: none;
color: #1b8183;
font-size: 2vw;
font-weight: bold;
}
.menu-btn {
height: 70px;
position: relative;
z-index: 3;
overflow: hidden;
padding-right: 50px;
cursor: pointer;
}
.menu-btn span {
width: 50px;
height: 4px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: #538b99;
border: 1px solid #538b99;
border-radius: 10px;
transition: all 0.5s;
}
.menu-btn span:nth-of-type(2) {
top: calc(40% - 5px);
}
.menu-btn span:nth-of-type(3) {
top: calc(60% + 5px);
}
.menu-btn.active span:nth-of-type(1) {
display: none;
}
.menu-btn.active span:nth-of-type(2) {
top: 50%;
transform: translate(-50%, 0%) rotate(45deg);
}
.menu-btn.active span:nth-of-type(3) {
top: 50%;
transform: translate(-50%, 0%) rotate(-45deg);
}
.menu {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding: 15px;
background: #f8f8f8;
transform: translateX(-100%);
transition: transform 0.5s;
}
.menu.active {
transform: translateX(0);
z-index: 2; /* > gsi =1 & < menu.active = 3 */
}
.menu li {
list-style-type: none;
font-family: 'TT Norms', Helvetica Now, Helvetica, Arial, sans-serif;
font-weight: normal;
font-style: normal;
font-size: 2vw;
padding-top: 2%;
}
.menu.active nav {
margin: 0 auto;
text-align: center;
}
.menu.active nav a {
position: relative;
color: black;
cursor: pointer;
line-height: 1;
text-decoration: none;
}
.menu.active nav a:after {
display: block;
position: absolute;
left: 0;
width: 0;
height: 3.5px;
background-color: black;
content: "";
transition: width 0.4s ease-out;
}
.menu.active nav a:hover:after,
.menu.active nav a:focus:after {
width: 100%;
}
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=0">
<title>Web-site</title>
</head>
<body>
<div class="container">
<div class="logo"><img src="https://i.postimg.cc/bYD24JGb/logo.png" alt="логотип"></div>
<div class="header">
<div class="menu-btn">
<span></span>
<span></span>
<span></span>
</div>
</div>
<div class="menu">
<nav>
<ul>
<li>Home</li>
<li>About</li>
<li>Services</li>
<li>Contacts</li>
</ul>
</nav>
</div>
<div class="gsi"><h1>NAME</h1><p>Lorem Ipsum</p><input type="button" class="button" value="Compose"></div>
<div class="pillar"><img src="https://i.postimg.cc/7hxMnrVX/pillar.png" alt="Pillar"></div>
</div>
</body>
</html>

Text won't stay with image slider when page is resized

I've got a pure CSS image slider and a block of text plus footer etc. underneath it. When the page is resized, the image slider resizes neatly and everything underneath it resizes, but the image slider pulls away from the block of text and everything while the block of text and everything else stays put. I've tried messing with the positioning of both the image slider and the section but everything ends up breaking the image slider or causing overlap. What am I doing wrong/how can I get this to work so that when the browser resizes and the slider gets smaller, the block of text and everything else beneath it stays stuck to the bottom of the slider and the whole page shrinks vertically to match how the slider shrinks vertically when resized? Please ignore any funny-looking buttons/links or whatever as I'm only including the code that is for the image slider and the rest of the text so as not to clutter up my included fiddle with code that doesn't need fixing. I know not to include static URLS inside the page but images won't load in the fiddle if I don't specify their exact locations.
If you want to see the test page running live, it's at Rack Inspections test page.
:root {
--ORANGE: #FA6114;
--BLUE: #0000FF;
--GREY: #787878;
}
/* apply a natural box layout model to all elements */
*, *:before, *:after {
margin: 0;
padding: 0;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
html, body {
height: 100%;
max-width: 100vw;
overflow-x: hidden;
}
html {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
max-width: 100vw;
}
body {
display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: flex;
-webkit-flex-direction: column;
-moz-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
min-height: 100vh;
color: var(--GREY);
}
.orange {
color: var(--ORANGE);
}
.blue {
color: var(--BLUE);
}
.grey {
color: var(--GREY);
}
.wrapper {
flex: 1 0 auto;
}
header {
margin: 0 auto;
height: 150px;
position: relative;
max-width: 100vw;
}
nav {
max-width: 100vw;
vertical-align: bottom;
outline: none;
position: relative;
list-style-type: none;
font-size: 22px;
font-family: 'Century Gothic', Arial, 'Arial Unicode MS', Helvetica, Sans-Serif;
margin-right: 30px;
cursor: pointer;
text-align: center;
float: right;
top: 15px;
}
nav a, nav a:link, nav a:visited, nav a:hover {
outline: none;
text-decoration: none;
color: var(--GREY);
}
nav a:active {
color: var(--ORANGE);
}
nav a:hover {
color: var(--BLUE);
}
ul#nav li {
display: inline-block;
padding: 0 19px;
}
section {
max-width: 100vw;
background: WHITE;
font-size: 13px;
font-family: Verdana, Geneva, Arial, Helvetica, Sans-Serif;
font-weight: normal;
font-style: normal;
position: relative;
cursor: default;
}
.SecTitle {
font-size: 40px;
margin-bottom: 15px;
}
.LinkCurrent {
color: var(--ORANGE);
cursor: default;
}
.logo {
position: relative;
top: 15px;
left: 30px;
max-width: 100vw;
height: auto;
}
article {
position: relative;
font-size: 20px;
margin-bottom: 0px;
margin-top: 0px;
margin-left: 5%;
margin-right: 5%;
}
.services {
font-size: 20px;
text-align: center;
display: block;
margin-top: 100px;
margin-left: auto;
margin-right: auto;
}
.PHSRLink {
display: inline-block;
margin: 0 25px 0 25px;
}
.inspectionsLink {
display: inline-block;
margin: 0 25px 0 25px;
vertical-align: top;
}
.PHSRTitle {
font-family: Century Gothic, Geneva, Arial, Helvetica, Sans-Serif;
font-size: 40px;
font-weight: bold;
}
footer {
flex-shrink: 0;
display: block;
float: right;
position: relative;
color: var(--GREY);
font-family: Century Gothic, Geneva, Arial, Helvetica, Sans-Serif;
font-size: 22px;
text-align: right;
padding: 100px 20px 20px 0;
}
footer a:link {
color: var(--ORANGE);
font-family: Verdana, Geneva, Arial, Helvetica, Sans-Serif;
text-decoration: none;
}
footer a:visited {
color: var(--ORANGE);
text-decoration: underline;
}
footer a:hover {
color: var(--BLUE);
text-decoration: underline;
}
/* Image Slider */
#slider {
max-width: 100vw;
width: 952px;
height: 409px;
overflow: hidden;
position: relative;
margin-top: 23px;
margin-bottom: 45px;
margin-left: auto;
margin-right: auto;
background-color: #FFF;
}
#slider > div {
width: 100%;
height: 100%;
background-size: contain;
background-repeat: no-repeat;
position: absolute;
animation: slide 20s infinite;
opacity: 0;
}
#slider > div:nth-child(2) {
animation-delay: 5s;
}
#slider > div:nth-child(3) {
animation-delay: 10s;
}
#slider > div:nth-child(4) {
animation-delay: 15s;
}
#slider > div:nth-child(5) {
animation-delay: 20s;
}
#keyframes slide {
10% {
opacity: 1;
}
20% {
opacity: 1;
}
30% {
opacity: 1;
}
40% {
opacity: 0;
}
}
<div id="wrapper">
<header>
<img class="logo" src="http://www.cafenocturne.com/RackInspections/images/logo.png" alt="Rack Inspections - Click to return to main page">
<nav>
<ul id="nav">
<li class="LinkCurrent">HOME</li>
<li>ABOUT</li>
<li>CONTACT US</li>
</ul>
</nav>
</header>
<section>
<div id="slider">
<div style="background-image:url('http://www.cafenocturne.com/RackInspections/images/slide1.png')"></div>
<div style="background-image:url('http://www.cafenocturne.com/RackInspections/images/slide2.png')"></div>
<div style="background-image:url('http://www.cafenocturne.com/RackInspections/images/slide3.png')"></div>
<div style="background-image:url('http://www.cafenocturne.com/RackInspections/images/slide4.png')"></div>
</div>
<article>
Rack Inspections process gives our clients a greater understanding of rack storage systems, best practices and safety awareness to ensure that your company is in compliance with all safety regulations. In addition, we provide straight forward racking inspections with detailed recommendations.<br>
</article>
<div class="services">
<div class="PHSRLink">
<div class="SecTitle orange">PHSR</div>
<img width="268" height="133" alt="Pre-Start Health and Safety Review image" src="http://www.cafenocturne.com/RackInspections/images/MainImage-1-GUY.png"><br><br>
PHSR (Pre-Start Health & Safety Review)?<br>
We can help.<br><br>
READ MORE<br><br>
</div>
<div class="inspectionsLink">
<div class="SecTitle orange">Inspections</div>
<img width="268" height="133" alt="Inspections image" src="http://www.cafenocturne.com/RackInspections/images/MainImage-2-Wrench.png"><br><br>
Rack inspections identify safety concerns<br>
and deficiencies with rack storage systems.<br><br>
READ MORE
</div>
</div>
</section>
<footer>
<span class="orange">info<span class="blue">#rackinspections</span>.ca</span><br>
Copyright <script>document.write(new Date().getFullYear())</script><br>
All Rights Reserved.<br>
<span style="font-size: 10px;">Designed by RackInspections.ca</span>
</footer>
</div>
When using background-size and specifically contain, the replaced content is scaled as large as possible maintaining its aspect ratio while fitting within the element’s content box. Because of this, a situation called letterboxing occurs, and this is a perfect example of that. The #slider has an initial height of 409px and although that "fits" nicely for larger viewports, for smaller viewports the images in the slider aren't occupying 100% of the 409px explicit height causing a bunch of whitespace between the images and the <article> text.
If you instead use background-size: cover on the #slider > div elements then the replaced content is sized to maintain its aspect ratio while filling the element’s entire content box. Now the text will always live right underneath the image slider for all viewport widths. To make the #slider height more responsive (ie not always 409px), you could swap the absolute unit value with a relative length unit like vh so its height is dynamically calculated by the browser.
:root {
--ORANGE: #FA6114;
--BLUE: #0000FF;
--GREY: #787878;
}
/* apply a natural box layout model to all elements */
*, *:before, *:after {
margin: 0;
padding: 0;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
html, body {
height: 100%;
max-width: 100vw;
overflow-x: hidden;
}
html {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
max-width: 100vw;
}
body {
display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: flex;
-webkit-flex-direction: column;
-moz-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
min-height: 100vh;
color: var(--GREY);
}
.orange {
color: var(--ORANGE);
}
.blue {
color: var(--BLUE);
}
.grey {
color: var(--GREY);
}
.wrapper {
flex: 1 0 auto;
}
header {
margin: 0 auto;
height: 150px;
position: relative;
max-width: 100vw;
}
nav {
max-width: 100vw;
vertical-align: bottom;
outline: none;
position: relative;
list-style-type: none;
font-size: 22px;
font-family: 'Century Gothic', Arial, 'Arial Unicode MS', Helvetica, Sans-Serif;
margin-right: 30px;
cursor: pointer;
text-align: center;
float: right;
top: 15px;
}
nav a, nav a:link, nav a:visited, nav a:hover {
outline: none;
text-decoration: none;
color: var(--GREY);
}
nav a:active {
color: var(--ORANGE);
}
nav a:hover {
color: var(--BLUE);
}
ul#nav li {
display: inline-block;
padding: 0 19px;
}
section {
max-width: 100vw;
background: WHITE;
font-size: 13px;
font-family: Verdana, Geneva, Arial, Helvetica, Sans-Serif;
font-weight: normal;
font-style: normal;
position: relative;
cursor: default;
}
.SecTitle {
font-size: 40px;
margin-bottom: 15px;
}
.LinkCurrent {
color: var(--ORANGE);
cursor: default;
}
.logo {
position: relative;
top: 15px;
left: 30px;
max-width: 100vw;
height: auto;
}
article {
position: relative;
font-size: 20px;
margin-bottom: 0px;
margin-top: 0px;
margin-left: 5%;
margin-right: 5%;
}
.services {
font-size: 20px;
text-align: center;
display: block;
margin-top: 100px;
margin-left: auto;
margin-right: auto;
}
.PHSRLink {
display: inline-block;
margin: 0 25px 0 25px;
}
.inspectionsLink {
display: inline-block;
margin: 0 25px 0 25px;
vertical-align: top;
}
.PHSRTitle {
font-family: Century Gothic, Geneva, Arial, Helvetica, Sans-Serif;
font-size: 40px;
font-weight: bold;
}
footer {
flex-shrink: 0;
display: block;
float: right;
position: relative;
color: var(--GREY);
font-family: Century Gothic, Geneva, Arial, Helvetica, Sans-Serif;
font-size: 22px;
text-align: right;
padding: 100px 20px 20px 0;
}
footer a:link {
color: var(--ORANGE);
font-family: Verdana, Geneva, Arial, Helvetica, Sans-Serif;
text-decoration: none;
}
footer a:visited {
color: var(--ORANGE);
text-decoration: underline;
}
footer a:hover {
color: var(--BLUE);
text-decoration: underline;
}
/* Image Slider */
#slider {
--h: 60;
max-width: 100vw;
width: 952px;
height: 45vh; /* Vary this */
height: calc(var(--h) * 1vmin); /* responsive unit */
overflow: hidden;
position: relative;
margin-top: 23px;
margin-bottom: 45px;
margin-left: auto;
margin-right: auto;
background-color: #FFF;
}
#slider > div {
width: 100%;
height: 100%;
background-size: cover;
background-repeat: no-repeat;
position: absolute;
animation: slide 20s infinite;
opacity: 0;
}
#slider > div:nth-child(2) {
animation-delay: 5s;
}
#slider > div:nth-child(3) {
animation-delay: 10s;
}
#slider > div:nth-child(4) {
animation-delay: 15s;
}
#slider > div:nth-child(5) {
animation-delay: 20s;
}
#keyframes slide {
10% {
opacity: 1;
}
20% {
opacity: 1;
}
30% {
opacity: 1;
}
40% {
opacity: 0;
}
}
<div id="wrapper">
<header>
<img class="logo" src="http://www.cafenocturne.com/RackInspections/images/logo.png" alt="Rack Inspections - Click to return to main page">
<nav>
<ul id="nav">
<li class="LinkCurrent">HOME</li>
<li>ABOUT</li>
<li>CONTACT US</li>
</ul>
</nav>
</header>
<section>
<div id="slider">
<div style="background-image:url('http://www.cafenocturne.com/RackInspections/images/slide1.png')"></div>
<div style="background-image:url('http://www.cafenocturne.com/RackInspections/images/slide2.png')"></div>
<div style="background-image:url('http://www.cafenocturne.com/RackInspections/images/slide3.png')"></div>
<div style="background-image:url('http://www.cafenocturne.com/RackInspections/images/slide4.png')"></div>
</div>
<article>
Rack Inspections process gives our clients a greater understanding of rack storage systems, best practices and safety awareness to ensure that your company is in compliance with all safety regulations. In addition, we provide straight forward racking inspections with detailed recommendations.<br>
</article>
<div class="services">
<div class="PHSRLink">
<div class="SecTitle orange">PHSR</div>
<img width="268" height="133" alt="Pre-Start Health and Safety Review image" src="http://www.cafenocturne.com/RackInspections/images/MainImage-1-GUY.png"><br><br>
PHSR (Pre-Start Health & Safety Review)?<br>
We can help.<br><br>
READ MORE<br><br>
</div>
<div class="inspectionsLink">
<div class="SecTitle orange">Inspections</div>
<img width="268" height="133" alt="Inspections image" src="http://www.cafenocturne.com/RackInspections/images/MainImage-2-Wrench.png"><br><br>
Rack inspections identify safety concerns<br>
and deficiencies with rack storage systems.<br><br>
READ MORE
</div>
</div>
</section>
<footer>
<span class="orange">info<span class="blue">#rackinspections</span>.ca</span><br>
Copyright <script>document.write(new Date().getFullYear())</script><br>
All Rights Reserved.<br>
<span style="font-size: 10px;">Designed by RackInspections.ca</span>
</footer>
</div>

Having trouble centering image vertically in responsive website [in both PC and mobile]

Here is what I see for my website:
website
As the image is below Navigation Bar, I want this to center vertically in my responsive website, similar to this website: https://www.ownhour.co.kr/#;
I have added width and height as 100% in internal image stylesheet and added margin and block in external CSS. After inspecting with the mobile version, it seems like the image is sitting at the top with a huge gap at the bottom.
Here is what I see for my website:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="monday.css">
<title>J[a]son</title>
</head>
<body>
<nav>
<div class = "logo">
<h4>J[a]son</h4>
</div>
<ul class = "nav-links">
<li>
HOME
</li>
<li>
PHOTOGRAPHY
<ul class="sub-menu">
<li>Colour</li>
<li>Black</li>
</ul>
</li>
<li>
CODING
</li>
<li>
ABOUT
</li>
</ul>
<div class= "burger">
<div class="line1"></div>
<div class="line2"></div>
<div class="line3"></div>
</div>
</nav>
<script src="testing.js"></script>
<img class="main_car" src="Photos/main_car.jpg" alt="car" width="100%" height="100%"/>
<!--<p>June, 2020. Sunshine Coast, BC, Canada </p>-->
</body>
</html>
CSS
* {
margin: 0px;
padding: 0px;
box-sizing: border-box;
}
nav {
display: flex;
justify-content: space-between;
/*padding-right: 2em;*/
padding-left: 2em;
padding-top: 2em;
padding-bottom: 1.5em;
align-items: center;
min-height: 8vh;
background-color: black;
/*font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;*/
font-family: 'Poppins', sans-serif;
}
.logo {
color: rgb(240, 235, 235);
font-size: 20px;
text-transform: uppercase;
letter-spacing: 5px;
}
.nav-links {
display: flex;
justify-content: space-around;
width: 30%;
}
.nav-links li {
list-style: none;
}
.nav-links a {
color: white;
text-decoration: none;
letter-spacing: 1px;
font-weight: bold;
font-size: 11px;
/*padding: 5px 5px;*/
}
.burger {
display: none;
cursor: pointer;
}
.burger div {
width: 25px;
height: 3px;
background-color: white;
margin: 5px;
transition: all 0.3s ease;
}
#media screen and (max-width:1430px) {
.nav-links {
width: 40%;
}
}
#media screen and (max-width:950px) {
body {
overflow-x: hidden;
}
.nav-links {
position: absolute;
right: 0px;
height: 92vh;
top: 8vh;
background-color: black;
display: flex;
flex-direction: column;
align-items: center;
width: 30%;
transform: translateX(100%);
padding-right: 2em;
transition: transform 0.5s ease-in;
}
.nav-links li {
opacity: 0;
}
.burger {
display: block;
padding-right: 1em;
}
.sub-menu {
position: relative;
}
}
.nav-active {
transform: translate(0%);
}
The question is how to center the car image and remain responsive.
As I understand it (and this may need adjustment for your particular case) the requirement is for the car image to fill space but not leave a huge gap underneath before the footers are reached.
To do this in this case I've set the body element to flex so that once it's decided what is needed space-wise for the navbar and footer it can fill the remaining space with the car.
I initially tried to do this with object-fit: contain and object-position: center within a wrapper around the car img. However, I could not make this work and instead I've removed the car image and set it as a background to a div instead and allowed this div to fill up any remaining space on the screen.
Here's the snippet.
* {
margin: 0px;
padding: 0px;
box-sizing: border-box;
}
body {
display: flex;
flex-direction: column;
height: 100vh;
}
nav {
display: flex;
justify-content: space-between;
/*padding-right: 2em;*/
padding-left: 2em;
padding-top: 2em;
padding-bottom: 1.5em;
align-items: center;
min-height: 8vh;
background-color: black;
/*font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;*/
font-family: 'Poppins', sans-serif;
}
.logo {
color: rgb(240, 235, 235);
font-size: 20px;
text-transform: uppercase;
letter-spacing: 5px;
}
.nav-links {
display: flex;
justify-content: space-around;
width: 30%;
}
.nav-links li {
list-style: none;
}
.nav-links a {
color: white;
text-decoration: none;
letter-spacing: 1px;
font-weight: bold;
font-size: 11px;
/*padding: 5px 5px;*/
}
.burger {
display: none;
cursor: pointer;
}
.burger div {
width: 25px;
height: 3px;
background-color: white;
margin: 5px;
transition: all 0.3s ease;
}
#media screen and (max-width:1430px) {
.nav-links {
width: 40%;
}
}
#media screen and (max-width:950px) {
body {
overflow-x: hidden;
}
.nav-links {
position: absolute;
right: 0px;
height: 92vh;
top: 8vh;
background-color: black;
display: flex;
flex-direction: column;
align-items: center;
width: 30%;
transform: translateX(100%);
padding-right: 2em;
transition: transform 0.5s ease-in;
}
.nav-links li {
opacity: 0;
}
.burger {
display: block;
padding-right: 1em;
}
.sub-menu {
position: relative;
}
}
.nav-active {
transform: translate(0%);https://ahweb.org.uk/car.png
}
.main_car_wrapper {
background-image: url(https://ahweb.org.uk/car.png);
background-repeat: no-repeat no-repeat;
background-position: center center;
background-size: contain;
width: 100%;
flex: 1 1 auto;
}
</style>
<nav>
<div class = "logo">
<h4>J[a]son</h4>
</div>
<ul class = "nav-links">
<li>
HOME
</li>
<li>
PHOTOGRAPHY
<ul class="sub-menu">
<li>Colour</li>
<li>Black</li>
</ul>
</li>
<li>
CODING
</li>
<li>
ABOUT
</li>
</ul>
<div class= "burger">
<div class="line1"></div>
<div class="line2"></div>
<div class="line3"></div>
</div>
</nav>
<script src="testing.js"></script>
<div class="main_car_wrapper">
</div>
And some more footer stuff here
<p>June, 2020. Sunshine Coast, BC, Canada </p>
UPDATED
Can use with code like
margin-left: -50px;
margin-right: -50px;
width:100px;
in
.main_car img {
position: absolute;
top: 50%;
left: 50%;
margin-left: [-50% of your image's width];
margin-top: [-50% of your image's height];
}
I'm added css like this
.main_car
{
position: relative;
}
.main_car img
{
position: absolute;
top: 50%;
left: 50%;
margin-left: [-50% of your image's width];
margin-top: [-50% of your image's height];
}
Then will get output like this
Centered Image
body {
background-color: black;
/*rgb(241, 233, 233);*/
}
* {
margin: 0px;
padding: 0px;
}
.main_car
{
position: relative;
}
.main_car img
{
position: absolute;
top: 50%;
left: 50%;
margin-left: -50px;
margin-right: -50px;
width:100px;
}
#media screen and (max-width:1430px) {
.nav-links {
width: 40%;
}
}
#media screen and (max-width:950px) {
body {
overflow-x: hidden;
}
.nav-links {
position: absolute;
right: 0px;
height: 92vh;
top: 8vh;
background-color: black;
display: flex;
flex-direction: column;
align-items: center;
width: 30%;
transform: translateX(100%);
padding-right: 2em;
transition: transform 0.5s ease-in;
}
.nav-links li {
opacity: 0;
}
.burger {
display: block;
padding-right: 1em;
}
.sub-menu {
position: relaative;
}
}
<div class="main_car">
<img src="https://www.gravatar.com/avatar/efb780ba8c3560a06d4c1a1825b1e800?s=32&d=identicon&r=PG" alt="car">
</div>

How to fix img in navbar not scaling

I'm trying to create a small website and want to place an image (logo, square, svg) in the navbar. I want the logo to fit the navbar but it simply just won't scale no matter what I try.
I've tried floating a div with the image to the left and the navbar to the right but it still won't scale. It's really frustrating.
Here's an image of the problem:
Here's my code (sorry it's messy):
#import url('https://fonts.googleapis.com/css?family=Montserrat');
.heading {
display: inline-block;
font-family: "Montserrat";
font-weight: lighter;
text-align: left;
margin-left: 20vw;
line-height: 30vw;
}
body {
width: 100%;
margin: auto;
font-family: 'Montserrat', sans-serif;
background-color: white;
}
.container {
display: flex;
flex-wrap: wrap;
flex-direction: row;
justify-content: center;
margin-top: 30px;
flex-flow: row wrap;
margin-top: -10vw;
}
img {
margin: 9px;
transition: filter 0.2s;
filter: brightness(100%);
display: inline-block;
min-height: 100px;
height: 50vh;
}
img:hover {
filter: brightness(80%);
}
.responsive:hover {}
header {
position: relative;
height: 50vh;
background-image: linear-gradient(rgb(50, 50, 50), rgb(30, 30, 30));
margin-top: -20px;
transform: skewY(-5deg);
transform-origin: top left;
}
.fullwidth {
width: 100%;
}
.headertitle {
margin-top: -36vh;
margin-left: 12vw;
position: absolute;
font-size: calc(13px + 2.5vw);
color: white;
font-family: 'Montserrat';
font-weight: lighter;
}
/* navbar */
nav {
background: rgb(52, 52, 52);
position: relative;
z-index: 1;
height: calc(18px + 6vh);
box-shadow: 0 3px 3px -1px rgba(0, 0, 0, 0.065);
overflow: auto;
width: 100vw;
}
nav ul {
margin: 0;
padding: 0;
text-align: left;
margin-left: 1.2vw;
}
nav ul li {
display: inline-block;
list-style: none;
font-size: 1.2em;
padding: 1vh;
}
.navul a {
text-decoration: none;
color: white;
line-height: 5.5vh;
height: 5.5vh;
font-size: calc(15px + 0.25vh + 0.15vw);
}
.navuul a:visited,
a:link,
a:active {
text-decoration: none;
color: white;
font-weight: 200;
line-height: 5.5vh;
height: 5.5vh;
}
.navuul a:hover {
text-decoration: none;
color: grey;
font-weight: 200;
line-height: 5.5vh;
height: 5.5vh;
}
.submit {
float: right;
margin-right: 1.5vw;
}
.submit a {
color: white;
border-radius: 5px;
}
.navimg img {
max-width: 100%;
max-height: 20%;
}
.navimgdiv {
height: 1.5vh;
}
/* navbar end */
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="pgallerystyles.css">
<title> Photo Gallery </title>
<link rel="shortcut icon" href="logo.ico">
</head>
<body>
<div class="fullwidth">
</div>
<nav>
<ul class="navul">
<li>
<div class="navimgdiv"><img class="navimg" src="logo.svg"></div>Lumastock</li>
<li>Photos</li>
<li>Featured</li>
<li>Contact</li>
<li>Pricing</li>
<li>Assesment Requirements</li>
<li class="submit">Submit a photo</li>
</ul>
</nav>
<header>
</header>
<h1 class="headertitle">Image Gallery</h1>
Thanks!
Simply use the logo outside of the list. I have added max-width for logo image. Optionally padding and margin you can customize based on your requirement. I hope this solution will be helpful.
.heading {
display: inline-block;
font-family: "Montserrat";
font-weight: lighter;
text-align: left;
margin-left: 20vw;
line-height: 30vw;
}
body {
width: 100%;
margin: auto;
font-family: 'Montserrat', sans-serif;
background-color: white;
}
.container {
display: flex;
flex-wrap: wrap;
flex-direction: row;
justify-content: center;
margin-top: 30px;
flex-flow: row wrap;
margin-top: -10vw;
}
img {
/* margin: 9px;
transition: filter 0.2s;
filter: brightness(100%);
display: inline-block;
min-height: 100px;
height: 50vh; */
max-width: 100%;
}
img:hover {
filter: brightness(80%);
}
.responsive:hover {}
header {
position: relative;
height: 50vh;
background-image: linear-gradient(rgb(50, 50, 50), rgb(30, 30, 30));
margin-top: -20px;
transform: skewY(-5deg);
transform-origin: top left;
}
.fullwidth {
width: 100%;
}
.headertitle {
margin-top: -36vh;
margin-left: 12vw;
position: absolute;
font-size: calc(13px + 2.5vw);
color: white;
font-family: 'Montserrat';
font-weight: lighter;
}
/* navbar */
nav {
background: rgb(52, 52, 52);
position: relative;
z-index: 1;
height: calc(40px + 6vh);
box-shadow: 0 3px 3px -1px rgba(0, 0, 0, 0.065);
overflow: auto;
width: 100vw;
display: flex;
}
nav ul {
margin: 0;
padding: 0;
text-align: left;
margin-left: 1.2vw;
}
nav ul li {
display: inline-block;
list-style: none;
font-size: 1.2em;
padding: 1vh;
}
.navul a {
text-decoration: none;
color: white;
line-height: 5.5vh;
height: 5.5vh;
font-size: calc(15px + 0.25vh + 0.15vw);
}
.navuul a:visited,
a:link,
a:active {
text-decoration: none;
color: white;
font-weight: 200;
line-height: 5.5vh;
height: 5.5vh;
}
.navuul a:hover {
text-decoration: none;
color: grey;
font-weight: 200;
line-height: 5.5vh;
height: 5.5vh;
}
.submit {
float: right;
margin-right: 1.5vw;
}
.submit a {
color: white;
border-radius: 5px;
}
.navimgdiv img {
max-width: 50px;
}
.navimgdiv {
padding: 5px 0;
}
<div class="fullwidth"></div>
<nav>
<a class="navimgdiv"><img src="https://cdn.worldvectorlogo.com/logos/react.svg"></a>
<ul class="navul">
<li>Lumastock</li>
<li>Photos</li>
<li>Featured</li>
<li>Contact</li>
<li>Pricing</li>
<li>Assesment Requirements</li>
<li class="submit">Submit a photo</li>
</ul>
</nav>
<header></header>
<h1 class="headertitle">Image Gallery</h1>

How do I position a link at the bottom of a responsive landing page with CSS

I'm trying to position a circular instagram icon so it is always centered towards the bottom of a landing page. All my efforts so far such as using position:fixed; have resulted in the icon not remaining underneath the rest of my content when the screen size changes.
My html is like this:
<!DOCTYPE html>
<html>
<head>
<title>RBM Makeup</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<section class="intro">
<div class="inner">
<div class="content">
<h1> Rebecca Bermingham Maguire</h1>
<div class="container">
Portfolio
Contact
About Me
</div>
</div>
</div>
<div class="footer">
<div class="instagram">
</div>
</div>
</section>
</body>
</html>
And my CSS is like this:
:root{
--maroon: #85144b;
--fuchsia: #f012be;
--purple: #b10dc9;
--lime: #01ff70;
--black: #000000;
--white: #ffffff;
--blue: #89cff0;
}
#font-face{
font-family: 'milkshake';
src:url(fonts/Milkshake.ttf);
font-style: normal;
font-weight: 100;
}
#font-face{
font-family: 'amble';
src:url(fonts/Amble-Regular.ttf);
font-style: normal;
font-weight: 100;
}
html, body{
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
/**/
.intro{
height:100%;
width:100%;
margin-right: 20px;
margin: auto;
background: url("images/eye.jpg") no-repeat 50% 50%;
display: table;
top: 0;
background-size: cover;
opacity: 0.92;
}
.intro .inner{
display: table-cell;
vertical-align: middle;
width: 100%;
max-width: none;
}
.content h1{
color: var(--black);
font-size: 350%;
margin: 0px 0px;
text-align: center;
text-transform: bold;
font-family: milkshake;
font-weight: 100;
}
.container{
display: flex;
flex-wrap: wrap;
overflow: hidden;
justify-content: center;
margin-top: 50px;
}
.container a{
border-radius: 9px;
color: var(--black);
font-size: 135%;
padding: 10px 20px;
text-decoration: none;
border: solid var(--black) 5px;
text-transform: uppercase;
margin: 20px 40px;
font-family: amble;
font-weight: 150;
font-style: bold;
}
/*Instagram Icon*/
.fa {
padding: 20px;
font-size: 55px;
width: 40px;
text-align: center;
text-decoration: none;
border-radius: 50%;
align-content: center;
}
.fa:hover{
opacity:0.7;
}
.fa-instagram {
background: var(--black);
color: var(--white);
}
.footer{
position: fixed;
bottom: 0;
width: 100%;
height: 100px;
left: 47.5%;
}
Any help would be greatly appreciated, thanks :)
Modified two places of your code.
1. .foot
left: 50% plus margin-left: - { width } / 2 can make footer align center no matter how the window changes.
```
.footer {
position: fixed;
bottom: 0;
width: 95px; // here
height: 100px;
left: 50%; // here
margin-left: calc(-95px / 2); // here
}
```
2. .fa
In your code, the Instagram icon is not aligning center inside the black circle, so I make some changes for it.
As the Instagram icon is square, you should not set the width 40px when it's font-size is 55px.
```
.fa {
padding: 20px;
font-size: 55px;
width: 55px; /* here */
text-align: center;
text-decoration: none;
border-radius: 50%;
align-content: center;
}
```
If you have more questions about my answer, feel free to contact me :)
:root {
--maroon: #85144b;
--fuchsia: #f012be;
--purple: #b10dc9;
--lime: #01ff70;
--black: #000000;
--white: #ffffff;
--blue: #89cff0;
}
#font-face {
font-family: 'milkshake';
src: url(fonts/Milkshake.ttf);
font-style: normal;
font-weight: 100;
}
#font-face {
font-family: 'amble';
src: url(fonts/Amble-Regular.ttf);
font-style: normal;
font-weight: 100;
}
html,
body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
/**/
.intro {
height: 100%;
width: 100%;
margin-right: 20px;
margin: auto;
background: url("images/eye.jpg") no-repeat 50% 50%;
display: table;
top: 0;
background-size: cover;
opacity: 0.92;
}
.intro .inner {
display: table-cell;
vertical-align: middle;
width: 100%;
max-width: none;
}
.content h1 {
color: var(--black);
font-size: 350%;
margin: 0px 0px;
text-align: center;
text-transform: bold;
font-family: milkshake;
font-weight: 100;
}
.container {
display: flex;
flex-wrap: wrap;
overflow: hidden;
justify-content: center;
margin-top: 50px;
}
.container a {
border-radius: 9px;
color: var(--black);
font-size: 135%;
padding: 10px 20px;
text-decoration: none;
border: solid var(--black) 5px;
text-transform: uppercase;
margin: 20px 40px;
font-family: amble;
font-weight: 150;
font-style: bold;
}
/*Instagram Icon*/
.fa {
padding: 20px;
font-size: 55px;
width: 55px; /* need to fit the font-size */
text-align: center;
text-decoration: none;
border-radius: 50%;
align-content: center;
}
.fa:hover {
opacity: 0.7;
}
.fa-instagram {
background: var(--black);
color: var(--white);
}
.footer {
position: fixed;
bottom: 0;
width: 95px;
height: 100px;
left: 50%;
margin-left: calc(-95px / 2);
}
<section class="intro">
<div class="inner">
<div class="content">
<h1> Rebecca Bermingham Maguire</h1>
<div class="container">
Portfolio
Contact
About Me
</div>
</div>
</div>
<div class="footer">
<div class="instagram">
</div>
</div>
</section>
set the parent as
.intro {
width:100%;
height:100vh;
position:relative;
}
and the icon element as
.footer {
position:absolute;
bottom:0;
left:50%;
width:40px;
margin-left:-20px;
}
as an alternative:
.footer {
position:absolute;
bottom:0;
left:0;
width:100%;
text-align:center;
}
.footer > div {
display:inline-block;
}
this will do better as you can add other elements if you end up wanting to add other links