Collapsed navbar elements being blocked by section content - html

The collapsed navbar is being hidden by the content in the section element - for example, when testing as a small device display (iphone se, etc), the section content blocks the navbar and when I click on the collapsed navbar toggle to get the routes, nothing happens. How come it's not pushing that content down to expand?
Am I wrapping the navbar and section wrong?
Using react, bootstrap v5.3.0-alpha1
export default function Navbar() {
return (
<nav className="navbar navbar-expand-sm">
<div className="container-fluid">
<Link to='/' className="navbar-brand d-none d-md-block">
<img src={"./logo.png"} style={{ height: '50px', width: '50px', borderRadius: '5px'}} alt='' />
</Link>
<button className="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
<span className="navbar-toggler-icon"></span>
</button>
<div className="collapse navbar-collapse text-center justify-content-start" id="navbarTogglerDemo01">
<div className="navbar-nav">
<a className="nav-link" href="/#">about_1</a>
<a className="nav-link" href="/#">about_2</a>
</div>
</div>
<div className="btn-toolbar" role="toolbar">
<div className="btn-group me-2" role="group">
<button type="button" className="btn btn-primary" onClick={signIn} id="sign_in_button">{user === null ? 'Sign In' : user}</button>
</div>
<div className="btn-group me-2" role="group">
<div className="dropdown">
<button className="btn" id="settings" type="button" data-bs-toggle="dropdown" aria-expanded="false" data-bs-auto-close="outside" style={{ height: '40px'}}>
<i className="bi bi-three-dots"></i>
</button>
<ul className="dropdown-menu dropdown-menu-end" style={{ width: '20vw'}} id="settings_menu">
<div className="container-fluid">
<div className="row">
<div className="col">
<li><h6 className="dropdown-header">Navigation</h6></li>
<li><Link to='/burn' className="dropdown-item">test</Link></li>
<li><a className="dropdown-item" href="https://xxx">test</a></li>
</div>
<div className="col">
<li><h6 className="dropdown-header">Other</h6></li>
<li><a className="dropdown-item" href="https://opensea.io/collection/test">test</a></li>
<li><a className="dropdown-item" href="https://opensea.io/collection/test">test</a></li>
</div>
</div>
<div className="row">
<li><hr className="dropdown-divider" /></li>
<li>
<a className="dropdown-item d-flex justify-content-between align-items-center" href="/#" onClick={() => theme === 'light' ? setTheme('dark') : setTheme('light')}>
Dark Theme
<i className="bi bi-moon"></i>
</a>
</li>
<br />
<br />
<div className="col" style={{ display: 'inline-flex'}}>
<li><a className="dropdown-item" href="https://twitter.com/test"><i className="bi bi-twitter"></i></a></li>
<li><a className="dropdown-item" href="https://t.me/test"><i className="bi bi-telegram"></i></a></li>
</div>
</div>
</div>
</ul>
</div>
</div>
</div>
</div>
</nav>
);
}
import Navbar from '../components/navbar.js';
export function Index() {
return (
<>
<Navbar></Navbar>
<section className="">
<div className="container col-xxl-8 px-4 py-5 position-absolute top-50 start-50 translate-middle">
<div className="row flex-lg-row-reverse align-items-center g-5 py-5">
<div className="col-10 col-sm-8 col-lg-6">
<img src={"./test.jpg"} className="d-none d-sm-block mx-lg-auto img-fluid" alt="Bootstrap Themes" width="500" height="250" loading="lazy" />
</div>
<div className="col-lg-6 text-start">
<h1 className="display-5 fw-bold lh-1 mb-3" style={{ fontSize: '72px'}}>TEST HEADER</h1>
<p className="lead">
Quickly design and customize responsive mobile-first
sites with Bootstrap, the world's most popular front-end open
source toolkit, featuring Sass variables and mixins, responsive grid system,
extensive prebuilt components, and powerful JavaScript plugins.
A powerful enterprise-grade infrastructure
</p>
<div className="d-grid gap-2 d-md-flex justify-content-md-start">
<button type="button" className="btn btn-primary btn-lg px-4 me-md-2">Try For Free</button>
{/* <button type="button" className="btn btn-outline-secondary btn-lg px-4">Default</button> */}
</div>
</div>
</div>
</div>
</section>
</>
);
}
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
#media only screen and (max-width: 576px) {
.navbar .btn-toolbar {
position: absolute;
top: 8px;
right: 12px;
}
}
#settings {
border-radius: 5px;
}
#settings:hover {
/* background: #e1e1e1; */
background: var(--bs-tertiary-bg);
border-radius: 5px;
}
/* html[data-bs-theme="dark"] #settings:hover {
background: var(--bs-tertiary-bg);
border-radius: 5px;
} */
.navbar a.nav-link {
margin: 0px 8px;
border-radius: 5px;
}
.navbar a.nav-link:hover {
/* background: #e1e1e1; */
background: var(--bs-tertiary-bg);
border-radius: 5px;
}
/* html[data-bs-theme="dark"] .navbar a.nav-link:hover {
background: var(--bs-tertiary-bg);
border-radius: 5px;
} */
#settings {
color: var(--bs-navbar-color);
}
#sign_in_button {
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
/* outline: webkit-focus-ring-color auto 1px; */
outline: none;
border: none;
}
#sign_in_button:hover {
transform: scale(1.05);
/* background: none; */
outline: none;
border: none;
}

Related

Bootstrap carousel captions, buttons and toggle dissappear on mobile but images remain. Problem remains on github pages

Mostly the issue appears on the index page with the toggle not appearing when i resize to smaller than tablet and the altogether the images become non responsive and the captions and buttons in the carousel disappear.
With any other page the responsiveness again stops after a certain width.
ill provide the css as it is because all things that have to do with media tags i tried again and again and at my current level im at the end of my wits.
Thank you in advance!
body {
overflow-x: hidden;
}
/* html, body {
height: 100vh;
height: calc(var(--vh, 1vh) * 100);
} */
#navigation {
min-height: 100vh;
min-width: 100vh;
background-color: #fff;
text-align: center;
}
.navbar-brand {
color: #fff;
font-family: 'Aclonica';
font-style: bold;
font-size: 1.5rem;
}
.nav-link {
color: #000;
font-family: 'Kurale';
font-weight: 600;
font-size: 1.2rem;
}
/* Search Bar */
.topnav input[type=text] {
float: right;
padding: 6px;
border: none;
margin-top: 8px;
margin-right: 16px;
font-size: 17px;
}
/* Carousel */
.carousel-item {
height: 100vh;
min-height: 300px;
background: repeat scroll center scroll;
-webkit-background-size: cover;
background-size: cover;
}
.carousel-item::before {
content: "";
display: block;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background: #000;
opacity: 0.4;
}
.carousel-caption {
bottom: 100px;
padding-left: 100px;
padding-right: 100px
}
.carousel-caption h5 {
font-size: 100px;
font-family: 'Unna';
font-weight: 700;
}
.carousel-caption p {
font-size: 18px;
top: 2rem;
}
.slider-btn {
margin-top: 30px;
}
.slider-btn .btn {
background-color: #ED72AE;
color: #fff;
border-radius: 0;
padding: 0.5rem 0.5rem;
font-size: 1rem;
margin: 2px;
}
/* This maintains the full image but no aspect ratio it appears stretched */
/* .w-100 {
width: 100% !important;
height: 100vh;
} */
/* This works better */
.carousel-inner>.carousel-item>img {
height: 100vh;
}
h3 a h5 {
font-family: 'Unna';
font-weight: 700;
}
.card-title{
font-family: 'Unna';
font-weight: 700;
}
.card-text{
font-family: 'Source Serif Pro';
}
p {
font-family: 'Source Serif Pro';
padding: 3% 10%;
line-height: 1.5rem;
}
.pdrak{
padding-top: 10%;
}
/* About Us */
#about-us {
background-color: #ED72AE;
min-height: 100vh;
min-width: 100vh;
}
.personal {
text-align: center;
padding: 10% 10%;
}
/* Contact */
#contact {
text-align: center;
min-height: 100vh;
min-width: 100vh;
padding: 20% 15%;
}
.social {
padding: 7% 5%;
font-size: 2rem;
}
p {
marging: 20%;
}
/* Products Page */
#home-products {
min-height: 100vh;
min-width: 100vh;
text-align: center;
}
.list {
padding: 9% 15% 5% 15%;
}
.col-lg-3 {
margin: 2% 0 5% 0;
}
.prod {
margin: 2% 0 5% 0;
}
.images {
width: 30%;
}
/* Notebook */
#home-notebooks {
background-color: #EAD4EB;
min-height: 100vh;
min-width: 100vh;
text-align: center;
padding: 7%15%;
}
.dropp{
font-family: 'Unna';
}
.hamb {
position: absolute;
position: fixed;
font-family: 'Aclonica';
font-size:1.5rem;
}
.sidenav {
height: 100%;
width: 0;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: none;
overflow-x: hidden;
transition: 0.5s;
padding-top: 60px;
}
.sidenav a {
padding: 8px 8px 8px 32px;
text-decoration: none;
font-size: 25px;
color: #000;
display: block;
transition: 0.3s;
}
.sidenav a:hover {
color: #f1f1f1;
}
.sidenav .closebtn {
position: absolute;
top: 0;
right: 25px;
font-size: 36px;
margin-left: 50px;
color: black;
}
/* Diaries */
#home-diaries {
background-color: #EAD4EB;
min-height: 100vh;
min-width: 100vh;
text-align: center;
padding: 7%15%;
}
/* Contact by mail */
#Contact-by-mail {
background-color: #EAD4EB;
padding-top: 5%;
min-height: 100vh;
min-width: 100vh;
text-align: center;
}
.subm {
text-align: left;
padding-left: 8%;
}
.colo1 {
padding-left: 15%;
}
.logo-resize {
width: 100%;
/* transform: rotate(25deg); */
text-align: center;
}
#media screen and (max-height: 450px) {
.sidenav {
padding-top: 15px;
}
.sidenav a {
font-size: 18px;
}
}
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<title>Drakollage</title>
<!-- Google Fonts -->
<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=Aclonica&family=Kurale&family=Sail&family=Source+Serif+Pro:wght#400;700&family=Unna:wght#400;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/styles.css">
<!-- icons -->
<script src="https://kit.fontawesome.com/6e87f84f27.js" crossorigin="anonymous"></script>
<link rel="icon" href="favicon.ico">
<!-- Bootstrap scrpits -->
<!-- <script src="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2" crossorigin="anonymous"></script> -->
</head>
<body>
<section id="navigation">
<nav class="navbar navbar-expand-lg fixed-top">
<div class="container-fluid">
<a class="navbar-brand" href="#navigation">Drakollage</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nar nav-link active" aria-current="page" href="#navigation">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="products.html">Products</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#contact">Contact</a>
</li>
<li class="nav-item">
<a class="nar1 nav-link" href="#about-us">About</a>
</li>
<input type="text" placeholder="Search..">
<button type="submit"><i class="fa fa-search"></i></button>
</ul>
</div>
</nav>
<!-- Example -->
<div id="carouselExampleCaptions" class="carousel slide" data-bs-ride="false">
<div class="carousel-indicators">
<button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
<button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="1" aria-label="Slide 2"></button>
<button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="2" aria-label="Slide 3"></button>
<button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="3" aria-label="Slide 4"></button>
<button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="4" aria-label="Slide 5"></button>
<button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="5" aria-label="Slide 6"></button>
<button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="6" aria-label="Slide 7"></button>
<button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="7" aria-label="Slide 8"></button>
</div>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://thumbs.dreamstime.com/b/santa-claus-red-hat-christmas-fish-carp-isolated-160961341.jpg" class="d-block w-100" alt="...">
<div class="carousel-caption d-none d-md-block">
<h5>Notebooks</h5>
<p>Some representative placeholder content for the first slide.</p>
<div class="slider-btn">
Show Me More
</div>
</div>
</div>
<div class="carousel-item">
<img src="https://thumbs.dreamstime.com/b/santa-claus-red-hat-christmas-fish-carp-isolated-160961341.jpg" class="d-block w-100" alt="...">
<div class="carousel-caption d-none d-md-block">
<h5>Ashtrays</h5>
<p>Some representative placeholder content for the second slide.</p>
<div class="slider-btn">
Show Me More
</div>
</div>
</div>
<div class="carousel-item">
<img src="https://thumbs.dreamstime.com/b/santa-claus-red-hat-christmas-fish-carp-isolated-160961341.jpg" class="d-block w-100" alt="...">
<div class="carousel-caption d-none d-md-block">
<h5>Bookmarks</h5>
<p>Some representative placeholder content for the third slide.</p>
<div class="slider-btn">
Show Me More
</div>
</div>
</div>
<div class="carousel-item">
<img src="https://thumbs.dreamstime.com/b/santa-claus-red-hat-christmas-fish-carp-isolated-160961341.jpg" class="d-block w-100" alt="...">
<div class="carousel-caption d-none d-md-block">
<h5>Boxes</h5>
<p>Some representative placeholder content for the third slide.</p>
<div class="slider-btn">
Show Me More
</div>
</div>
</div>
<div class="carousel-item">
<img src="https://thumbs.dreamstime.com/b/santa-claus-red-hat-christmas-fish-carp-isolated-160961341.jpg" class="d-block w-100" alt="...">
<div class="carousel-caption d-none d-md-block">
<h5>Stickers</h5>
<p>Some representative placeholder content for the third slide.</p>
<div class="slider-btn">
Show Me More
</div>
</div>
</div>
<div class="carousel-item">
<img src="https://thumbs.dreamstime.com/b/santa-claus-red-hat-christmas-fish-carp-isolated-160961341.jpg" class="d-block w-100" alt="...">
<div class="carousel-caption d-none d-md-block">
<h5>Coasters</h5>
<p>Some representative placeholder content for the third slide.</p>
<div class="slider-btn">
Show Me More
</div>
</div>
</div>
<div class="carousel-item">
<img src="https://thumbs.dreamstime.com/b/santa-claus-red-hat-christmas-fish-carp-isolated-160961341.jpg" class="d-block w-100" alt="...">
<div class="carousel-caption d-none d-md-block">
<h5>Diaries</h5>
<p>Some representative placeholder content for the third slide.</p>
<div class="slider-btn">
Show Me More
</div>
</div>
</div>
<div class="carousel-item">
<img src="https://thumbs.dreamstime.com/b/santa-claus-red-hat-christmas-fish-carp-isolated-160961341.jpg" class="resize d-block w-100" alt="...">
<div class="carousel-caption d-none d-md-block">
<h5>Design it yourself</h5>
<p>Some representative placeholder content for the third slide.</p>
<div class="slider-btn">
Let's Go
</div>
</div>
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
<!-- Products
Contact
About US -->
<!-- they didnt work -->
<!-- <button type="button" class=" navigation btn btn-dark btn-lg btn-outline-light download-button">About us</button>
<button type="button" class=" navigation btn btn-dark btn-lg btn-outline-light download-button">Contact</button>
<button type="button" class=" navigation btn btn-dark btn-lg btn-outline-light download-button">Products</button> -->
</section>
<section id="about-us">
<div class="row">
<div class=" personal col-lg-6">
<i class=" icons fa-solid fa-circle-check fa-4x"></i>
<h3>Drakollage</h3>
<p class="pdrak">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, </p>
</div>
<div class=" personal col-lg-6">
<i class=" icons fa-solid fa-heart fa-4x"></i>
<h3>The maker</h3>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, </p>
</div>
</div>
</section>
<footer id="contact">
<div class="distance">
<i class="social fa-brands fa-instagram"></i></a>
<i class="social fa-solid fa-envelope"></i>
<p>© Copyright Drakollage</p>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</body>
</html>

html: overflow issue on mobile

I'm having an issue with parallax effect on mobile. In fact it seems like that total body size is > 100vh (it also appear the scroll bar o the side). Obv if I change overflow-y from auto to hidden, it fix the problem but it also cut out part of the page. On desktop it doesn't happen. Can anybody help me?
Screenshot:
https://imgur.com/a/n9wMmqN
.selector-for-some-widget {
box-sizing: content-box;
}
header .carousel-item {
height: 100vh;
min-height: 350px;
background: no-repeat center center scroll;
-webkit-background-size: cover;
background-size: cover;
}
body {
margin: 0;
background-color: white;
font-family: 'Open Sans', sans-serif;
min-height: 100%;
}
.wrapper {
height: 100vh;
overflow-y: auto;
overflow-x: hidden;
perspective: 10px;
}
header {
position: relative;
display: flex;
justify-content: center;
align-items: center;
height: calc(100% - 75px);
transform-style: preserve-3d;
z-index: -1;
}
.background {
transform: translateZ(-10px) scale(2.5);
}
.background {
position: absolute;
height: 100%;
width: 100%;
object-fit: cover;
z-index: -1;
}
.title {
font-family: 'Montez', cursive;
color: white;
text-align: center;
}
section {
background-color: white;
}
.navbar {
height: 75px;
font-size: 1.25rem;
letter-spacing: 3px;
font-weight: bold;
}
.navbar-brand {
font-size: 1.75rem;
letter-spacing: 10px;
}
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<!-- Bootstrap Icon CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons#1.8.1/font/bootstrap-icons.css">
<!-- Style CSS -->
<link rel="stylesheet" href="css/styles.css">
<title>Ariano Francesco Photography</title>
</head>
<body>
<div class="wrapper">
<header>
<div id="carouselExampleControls" class="carousel slide background" data-bs-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active" style="background-image: url('img/carousel_1.jpg')">
</div>
<div class="carousel-item" style="background-image: url('img/carousel_2.jpg')">
</div>
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleControls"
data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carouselExampleControls"
data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
<div class="title">
<h1>Ariano Francesco</h1>
<h2>Photography</h2>
</div>
</header>
<section>
<nav class="navbar navbar-expand-lg navbar-light bg-white sticky-top shadow-sm">
<div class="container px-5">
<a class="navbar-brand" href="#">AFR</a>
<button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasNavbar"
aria-controls="offcanvasNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvasNavbar"
aria-labelledby="offcanvasNavbarLabel">
<div class="offcanvas-header justify-content-end">
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas"
aria-label="Close"></button>
</div>
<div class="offcanvas-body d-flex text-center align-items-center">
<ul class="navbar-nav justify-content-end flex-grow-1">
<li class="nav-item ms-2">
<a class="nav-link active" aria-current="page" href="index.html">Gallery</a>
</li>
<li class="nav-item ms-2">
<a class="nav-link" href="contact.html">Contact</a>
</li>
</ul>
</div>
</div>
</div>
</nav>
<div class="container px-5">
<div class="text-center mt-5">
<h2 class="fw-bold fade-in">Gallery</h2>
</div>
<div class="row mt-5">
<div class="col-lg-4 col-md-12">
<a href="img/_IMG1556.jpg" data-toggle="lightbox" data-gallery="gallery" class="fade-in">
<img src="img/_IMG1556.jpg" class="img-fluid rounded mb-4">
</a>
<a href="img/_IMG1594.jpg" data-toggle="lightbox" data-gallery="gallery" class="fade-in">
<img src="img/_IMG1594.jpg" class="img-fluid rounded mb-4">
</a>
</div>
<div class="col-lg-4">
<a href="img/_IMG1491.jpg" data-toggle="lightbox" data-gallery="gallery" class="fade-in">
<img src="img/_IMG1491.jpg" class="img-fluid rounded mb-4">
</a>
<a href="img/_IMG1558.jpg" data-toggle="lightbox" data-gallery="gallery" class="fade-in">
<img src="img/_IMG1558.jpg" class="img-fluid rounded mb-4">
</a>
</div>
<div class="col-lg-4">
<a href="img/_IMG74c91.jpg" data-toggle="lightbox" data-gallery="gallery" class="fade-in">
<img src="img/_IMG74c91.jpg" class="img-fluid rounded mb-4">
</a>
<a href="img/_IMG1510.jpg" data-toggle="lightbox" data-gallery="gallery" class="fade-in">
<img src="img/_IMG1510.jpg" class="img-fluid rounded mb-4">
</a>
</div>
</div>
</div>
<footer class="text-center text-muted">
<div class="container px-5">
<div class="mb-4 border-bottom">
<a class="btn btn-floating m-3" href="https://instagram.com/_afr.photo" role="button"><i
class="bi bi-facebook"></i></a>
<a class="btn btn-floating m-3" href="https://www.facebook.com/ArianoFrancescoPH" role="button"><i
class="bi bi-instagram"></i></a>
</div>
<div class="mb-4">
<h6 class="text-uppercase fw-bold mb-4">
Contact
</h6>
<p>
Castagnole delle Lanze, AT
</p>
<p>
franci.ariano#gmail.com
</p>
<p>
339 2350792
</p>
</div>
</div>
<div class="p-4" style="background-color: rgba(0, 0, 0, 0.05);">
© 2022 Copyright:
<a class="text-reset fw-bold" href="www.afr.altervista.org">Ariano Francesco Photography</a>
</div>
</footer>
</section>
</div>
<!-- Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
crossorigin="anonymous"></script>
<!-- Lightbox for Bootstrap 5 -->
<script src="https://cdn.jsdelivr.net/npm/bs5-lightbox#1.7.11/dist/index.bundle.min.js"></script>
<!-- Script.js -->
<script src="js/script.js"></script>
</body>
</html>
Look at this answer: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
// First we get the viewport height and we multiple it by 1% to get a value for a vh unit
let vh = window.innerHeight * 0.01;
// Then we set the value in the --vh custom property to the root of the document
document.documentElement.style.setProperty('--vh', `${vh}px`);
body {
background-color: #333;
}
.module {
height: 100vh; /* Use vh as a fallback for browsers that do not support Custom Properties */
height: calc(var(--vh, 1vh) * 100);
margin: 0 auto;
max-width: 30%;
}
.module__item {
align-items: center;
display: flex;
height: 20%;
justify-content: center;
}
.module__item:nth-child(odd) {
background-color: #fff;
color: #F73859;
}
.module__item:nth-child(even) {
background-color: #F73859;
color: #F1D08A;
}
<div class="module">
<div class="module__item">20%</div>
<div class="module__item">40%</div>
<div class="module__item">60%</div>
<div class="module__item">80%</div>
<div class="module__item">100%</div>
</div>
Fix 100vh Issue on Mobile Devices Using CSS Only
Sometimes, the purpose of using vh unit is to simply create sections equal to the height of the viewport. This is common when you are building landing pages, for instance. In these situations, position sticky won’t help and I want to introduce the fill-available property. It’s easy to use, just remember to use the prefixes and the fall-back value:
.layout {
min-height: 100vh; /* fall-back */
min-height: -moz-available;
min-height: -webkit-fill-available;
min-height: fill-available;
}
Just as simple as that!

Problem in sizing image when using z-index

When i don't specify the position of my sections, the phone image perfectly follows the assigned width.
Which is - width: 60%;
But when i apply position and z-index to the first two sections the width: 60%; doesn't get applied, as the phone image becomes way too large.
HTML & CSS code:
body {
font-family: 'Montserrat', sans-serif;
font-weight: 600;
}
#title {
background-color: #ff4c68;
color: #FFFFFF;
}
h1 {
font-family: 'Montserrat', sans-serif;
font-weight: 800;
font-size: 3.5rem;
Line-height: 1.5;
}
h2 {
font-family: 'Montserrat', sans-serif;
font-weight: 700;
font-size: 2rem;
}
h3 {
font-family: 'Montserrat', sans-serif;
font-weight: 800;
font-size: 1.5rem;
}
.container-fluid {
padding: 3% 15% 7%;
}
p {
font-family: "Ubuntu";
color: #8f8f8f;
}
/* Navigation Bar */
.navbar-brand {
font-family: "Ubuntu";
font-size: 2.5rem;
}
.navbar {
padding-bottom: 4.5em;
}
.nav-item {
padding: 0 18px;
}
.nav-link {
font-size: 1.2rem;
font-family: "Montserrat";
font-weight: 100;
}
/* Download buttons */
.download-button {
margin: 5% 3% 5% 0;
}
/* Title image */
.title-image {
width: 60%;
transform: rotate(25deg);
position: absolute;
}
/* feature section */
#features {
padding: 7% 15%;
background-color: #FFFFFF;
position: relative;
z-index: 1;
}
.feature-box {
text-align: center;
padding: 5%;
}
.icon {
margin-bottom: 1rem;
color: #ef8172;
}
.icon:hover {
color: #ff4c68;
}
/* testimonials */
#testimonials {
text-align: center;
background-color: #ef8172;
color: #fff;
}
.carousel-item {
padding: 7% 15%;
}
.testimonial-image {
width: 10%;
border-radius: 100%;
margin: 20px;
}
/* Press */
#press {
background-color: #ef8172;
text-align: center;
padding-bottom: 3%;
}
.press-logo {
width: 15%;
padding: 20px 20px 50px;
}
/* Pricing */
#pricing {
padding: 100px;
text-align: center;
}
.pricing-col {
padding: 3% 2%;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>TinDog</title>
<!-- Bootstap css -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<!-- CSS Stylesheets -->
<link rel="stylesheet" href="css/styles.css">
<!-- Google fonts -->
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght#400;500;600;700;800&family=Ubuntu:wght#500&display=swap" rel="stylesheet">
<!-- Bootstrap scripts -->
<script src="jquery-3.5.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/#popperjs/core#2.10.2/dist/umd/popper.min.js" integrity="sha384-7+zCNj/IqJ95wo16oMtfsKbZ9ccEh31eOz1HGyDuCQ6wgnyJNSYdrPa03rtR1zdB" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.min.js" integrity="sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13" crossorigin="anonymous"></script>
<!-- font awesome -->
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous" />
</head>
<body>
<section id="title">
<div class="container-fluid">
<!-- Nav Bar -->
<nav class="navbar navbar-expand-lg navbar-dark">
<a class="navbar-brand" href=""> tindog</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nav-link" href="">Contact</a>
</li>
<li class="nav-item">
<a class="nav-link" href="">Pricing</a>
</li>
<li class="nav-item">
<a class="nav-link" href="">Download</a>
</li>
</ul>
</div>
</nav>
<!-- Title -->
<div class="row">
<div class="col-md-6">
<h1>Meet new and interesting dogs nearby.</h1>
<button type="button" class="btn btn-dark btn-lg download-button"><i class="fab fa-apple"></i> Download</button>
<button type="button" class="btn btn-outline-light btn-lg download-button"><i class="fab fa-google-play"></i> Download</button>
</div>
<div class="col-md-6">
<img class="title-image" src="images/iphone6.png" alt="iphone-mockup">
</div>
</div>
</div>
</section>
<!-- Features -->
<section id="features">
<div class="row">
<div class="feature-box col-md-4">
<i class="icon fas fa-check-circle fa-5x"></i>
<h3>Easy to use.</h3>
<p>So easy to use, even your dog could do it.</p>
</div>
<div class=" feature-box col-md-4">
<i class="icon fas fa-bullseye fa-5x"></i>
<h3>Elite Clientele</h3>
<p>We have all the dogs, the greatest dogs.</p>
</div>
<div class=" feature-box col-md-4">
<i class="icon fas fa-heart fa-5x"></i>
<h3>Guaranteed to work.</h3>
<p>Find the love of your dog's life or your money back.</p>
</div>
</div>
</section>
<!-- Testimonials -->
<section id="testimonials">
<div id="carouselExampleControls" class="carousel slide" data-bs-ride="carousel" data-bs-interval="3000">
<div class="carousel-inner">
<div class="carousel-item active">
<h2>I no longer have to sniff other dogs for love. I've found the hottest Corgi on TinDog. Woof.</h2>
<img class="testimonial-image" src="images/dog-img.jpg" alt="dog-profile">
<em>Pebbles, New York</em>
</div>
<div class="carousel-item">
<h2 class="testimonial-text">My dog used to be so lonely, but with TinDog's help, they've found the love of their life. I think.</h2>
<img class="testimonial-image" src="images/lady-img.jpg" alt="lady-profile">
<em>Beverly, Illinois</em>
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleControls" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carouselExampleControls" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
</section>
<!-- Press -->
<section id="press">
<img class="press-logo" src="images/techcrunch.png" alt="tc-logo">
<img class="press-logo" src="images/tnw.png" alt="tnw-logo">
<img class="press-logo" src="images/bizinsider.png" alt="biz-insider-logo">
<img class="press-logo" src="images/mashable.png" alt="mashable-logo">
</section>
<!-- Pricing -->
<section id="pricing">
<h2>A Plan for Every Dog's Needs</h2>
<p>Simple and affordable price plans for your and your dog.</p>
<div class="row ">
<div class="pricing-col col-lg-4 col-md-6">
<div class="card">
<div class="card-header">
<h3>Chihuahua</h3>
</div>
<div class="card-body">
<h2>Free</h2>
<p>5 Matches Per Day</p>
<p>10 Messages Per Day</p>
<p>Unlimited App Usage</p>
<div class="d-grid col-6 mx-auto">
<button type="button" class="btn btn-lg btn-outline-dark">Sign Up</button>
</div>
</div>
</div>
</div>
<div class="pricing-col col-lg-4 col-md-6">
<div class="card">
<div class="card-header">
<h3>Labrador</h3>
</div>
<div class="card-body">
<h2>$49 / mo</h2>
<p>Unlimited Matches</p>
<p>Unlimited Messages</p>
<p>Unlimited App Usage</p>
<div class="d-grid col-6 mx-auto">
<button type="button" class="btn btn-lg btn-dark">Sign Up</button>
</div>
</div>
</div>
</div>
<div class="pricing-col col-lg-4 col-md-12">
<div class="card">
<div class="card-header">
<h3>Mastiff</h3>
</div>
<div class="card-body">
<h2>$99 / mo</h2>
<p>Pirority Listing</p>
<p>Unlimited Matches</p>
<p>Unlimited Messages</p>
<p>Unlimited App Usage</p>
<div class="d-grid col-6 mx-auto">
<button type="button" class="btn btn-lg btn-dark">Sign Up</button>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Call to Action -->
<section id="cta">
<h3>Find the True Love of Your Dog's Life Today.</h3>
<button type="button">Download</button>
<button type="button">Download</button>
</section>
<!-- Footer -->
<footer id="footer">
<p>© Copyright 2018 TinDog</p>
</footer>
</body>
</html>
I want the end result to be like this:
image of the phone:
Hey buddy I really don't know if this is the correct way of doing it, but it seems to work just fine. What I did was change the width to max width the make it from 60% to 18%. It looks good and like the lesson. then when you switch it to tablet or mobile, I had the #media function change it back to 60% so it didn't shrink all the way down and look weird. idk if I'm explaining it correctly but here's the code:
.title-image {
max-width: 18%;
transform: rotate(25deg);
position: absolute;
right: 22%;
}
#media (max-width: 991px) {
.title-image {
position: static;
transform: rotate(0deg);
max-width: 60%;
}
}
I'm a complete beginner like you but I hope this helped in any way.
You only really need to set the position of your first section to achieve this, if you set the title's position: relative; and z-index: -1;, you won't need to set the position on your .title-image class. See the snippet(Full page) below for your reference.
Here is the snippet's result:
body {
font-family: 'Montserrat', sans-serif;
font-weight: 600;
}
#title {
background-color: #ff4c68;
color: #FFFFFF;
height: 90%;
max-height: 900px;
display: flex;
justify-content: space-evenly;
padding-inline: 10%;
position: relative;
z-index: -1;
}
h1 {
font-family: 'Montserrat', sans-serif;
font-weight: 800;
font-size: 3.5rem;
Line-height: 1.5;
}
h2 {
font-family: 'Montserrat', sans-serif;
font-weight: 700;
font-size: 2rem;
}
h3 {
font-family: 'Montserrat', sans-serif;
font-weight: 800;
font-size: 1.5rem;
}
.container-fluid {
padding: 3% 15% 7%;
}
p {
font-family: "Ubuntu";
color: #8f8f8f;
}
/* Navigation Bar */
.navbar-brand {
font-family: "Ubuntu";
font-size: 2.5rem;
}
.navbar {
padding-bottom: 4.5em;
margin-bottom: 3rem;
}
.nav-item {
padding: 0 18px;
}
.nav-link {
font-size: 1.2rem;
font-family: "Montserrat";
font-weight: 100;
}
/* Download buttons */
.download-button {
margin: 5% 3% 5% 0;
}
/* Title image */
.title-image {
width: 70%;
transform: rotate(25deg);
}
/* feature section */
#features {
padding: 7% 15%;
background-color: #FFFFFF;
}
.feature-box {
text-align: center;
padding: 5%;
}
.icon {
margin-bottom: 1rem;
color: #ef8172;
}
.icon:hover {
color: #ff4c68;
}
/* testimonials */
#testimonials {
text-align: center;
background-color: #ef8172;
color: #fff;
}
.carousel-item {
padding: 7% 15%;
}
.testimonial-image {
width: 10%;
border-radius: 100%;
margin: 20px;
}
/* Press */
#press {
background-color: #ef8172;
text-align: center;
padding-bottom: 3%;
}
.press-logo {
width: 15%;
padding: 20px 20px 50px;
}
/* Pricing */
#pricing {
padding: 100px;
text-align: center;
}
.pricing-col {
padding: 3% 2%;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>TinDog</title>
<!-- Bootstap css -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<!-- CSS Stylesheets -->
<link rel="stylesheet" href="css/styles.css">
<!-- Google fonts -->
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght#400;500;600;700;800&family=Ubuntu:wght#500&display=swap" rel="stylesheet">
<!-- Bootstrap scripts -->
<script src="jquery-3.5.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/#popperjs/core#2.10.2/dist/umd/popper.min.js" integrity="sha384-7+zCNj/IqJ95wo16oMtfsKbZ9ccEh31eOz1HGyDuCQ6wgnyJNSYdrPa03rtR1zdB" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.min.js" integrity="sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13" crossorigin="anonymous"></script>
<!-- font awesome -->
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous" />
</head>
<body>
<section id="title">
<div class="container-fluid">
<!-- Nav Bar -->
<nav class="navbar navbar-expand-lg navbar-dark">
<a class="navbar-brand" href=""> tindog</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nav-link" href="">Contact</a>
</li>
<li class="nav-item">
<a class="nav-link" href="">Pricing</a>
</li>
<li class="nav-item">
<a class="nav-link" href="">Download</a>
</li>
</ul>
</div>
</nav>
<!-- Title -->
<div class="row">
<div class="col-md-6">
<h1>Meet new and interesting dogs nearby.</h1>
<button type="button" class="btn btn-dark btn-lg download-button"><i class="fab fa-apple"></i> Download</button>
<button type="button" class="btn btn-outline-light btn-lg download-button"><i class="fab fa-google-play"></i> Download</button>
</div>
<div class="col-md-6">
<img class="title-image" src="https://i.stack.imgur.com/uz7Pc.png" alt="iphone-mockup">
</div>
</div>
</div>
</section>
<!-- Features -->
<section id="features">
<div class="row">
<div class="feature-box col-md-4">
<i class="icon fas fa-check-circle fa-5x"></i>
<h3>Easy to use.</h3>
<p>So easy to use, even your dog could do it.</p>
</div>
<div class=" feature-box col-md-4">
<i class="icon fas fa-bullseye fa-5x"></i>
<h3>Elite Clientele</h3>
<p>We have all the dogs, the greatest dogs.</p>
</div>
<div class=" feature-box col-md-4">
<i class="icon fas fa-heart fa-5x"></i>
<h3>Guaranteed to work.</h3>
<p>Find the love of your dog's life or your money back.</p>
</div>
</div>
</section>
<!-- Testimonials -->
<section id="testimonials">
<div id="carouselExampleControls" class="carousel slide" data-bs-ride="carousel" data-bs-interval="3000">
<div class="carousel-inner">
<div class="carousel-item active">
<h2>I no longer have to sniff other dogs for love. I've found the hottest Corgi on TinDog. Woof.</h2>
<img class="testimonial-image" src="images/dog-img.jpg" alt="dog-profile">
<em>Pebbles, New York</em>
</div>
<div class="carousel-item">
<h2 class="testimonial-text">My dog used to be so lonely, but with TinDog's help, they've found the love of their life. I think.</h2>
<img class="testimonial-image" src="images/lady-img.jpg" alt="lady-profile">
<em>Beverly, Illinois</em>
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleControls" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carouselExampleControls" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
</section>
<!-- Press -->
<section id="press">
<img class="press-logo" src="images/techcrunch.png" alt="tc-logo">
<img class="press-logo" src="images/tnw.png" alt="tnw-logo">
<img class="press-logo" src="images/bizinsider.png" alt="biz-insider-logo">
<img class="press-logo" src="images/mashable.png" alt="mashable-logo">
</section>
<!-- Pricing -->
<section id="pricing">
<h2>A Plan for Every Dog's Needs</h2>
<p>Simple and affordable price plans for your and your dog.</p>
<div class="row ">
<div class="pricing-col col-lg-4 col-md-6">
<div class="card">
<div class="card-header">
<h3>Chihuahua</h3>
</div>
<div class="card-body">
<h2>Free</h2>
<p>5 Matches Per Day</p>
<p>10 Messages Per Day</p>
<p>Unlimited App Usage</p>
<div class="d-grid col-6 mx-auto">
<button type="button" class="btn btn-lg btn-outline-dark">Sign Up</button>
</div>
</div>
</div>
</div>
<div class="pricing-col col-lg-4 col-md-6">
<div class="card">
<div class="card-header">
<h3>Labrador</h3>
</div>
<div class="card-body">
<h2>$49 / mo</h2>
<p>Unlimited Matches</p>
<p>Unlimited Messages</p>
<p>Unlimited App Usage</p>
<div class="d-grid col-6 mx-auto">
<button type="button" class="btn btn-lg btn-dark">Sign Up</button>
</div>
</div>
</div>
</div>
<div class="pricing-col col-lg-4 col-md-12">
<div class="card">
<div class="card-header">
<h3>Mastiff</h3>
</div>
<div class="card-body">
<h2>$99 / mo</h2>
<p>Pirority Listing</p>
<p>Unlimited Matches</p>
<p>Unlimited Messages</p>
<p>Unlimited App Usage</p>
<div class="d-grid col-6 mx-auto">
<button type="button" class="btn btn-lg btn-dark">Sign Up</button>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Call to Action -->
<section id="cta">
<h3>Find the True Love of Your Dog's Life Today.</h3>
<button type="button">Download</button>
<button type="button">Download</button>
</section>
<!-- Footer -->
<footer id="footer">
<p>© Copyright 2018 TinDog</p>
</footer>
</body>
</html>
You can familiarize yourself with css position property here.
PS. I won't be including any #media queries as it isn't part of the question.

How to enable scroll for specific portion of a HTML page

I am using Scss for styling the page and need to set scroll for specific parts of a HTML page.
when a user doing a scroll I need to keep the Categories(left) & Cart (Right) area to be strick in their position. But the center part needs to be scroll till the filtered items are reaching the top (bottom of the breadcrumb). If the user scroll further the filtered items will scroll underneath the filter and search bar section.
Can Anyone help me to fix it.
HTML :
<div class="container-fluid px-5">
<div class="row pt-4 pr-0">
<div class="col-sm-12 px-4 pt-2">
<app-gropcard-breadcrumb></app-gropcard-breadcrumb>
</div>
<div class="col-sm-12">
<div class="row">
<div class="col-sm-3">
<mat-card class="col-sm-12 p-0 mat-elevation-z10" style="background-color: #0084FF;color: white;">
<mat-card-header class="d-flex justify-content-center p-2">
<mat-card-title class="mb-0">Categories</mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-tree [dataSource]="dataSource" [treeControl]="treeControl" class="tree mt-3 pl-3 ">
<!-- This is the tree node template for leaf nodes -->
<mat-tree-node *matTreeNodeDef="let node" matTreeNodeToggle>
<li class="mat-tree-node">
<!-- use a disabled button to provide padding for tree leaf -->
<button class="TreeButton" mat-icon-button disabled></button>
<span (click)="Category(node)">{{node.name}}</span>
</li>
</mat-tree-node>
<!-- This is the tree node template for expandable nodes -->
<mat-nested-tree-node *matTreeNodeDef="let node; when: hasChild">
<li>
<div class="mat-tree-node" [attr.aria-label]="'toggle ' + node.name">
<button class="TreeButton" mat-icon-button matTreeNodeToggle
[attr.aria-label]="'toggle ' + node.name">
<mat-icon class="mat-icon-rtl-mirror">
{{treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right'}}
</mat-icon>
</button>
<span matTreeNodeToggle (click)="Category(node)">{{node.name}}</span>
</div>
<ul class="pl-2" [class.tree-invisible]="!treeControl.isExpanded(node)">
<ng-container matTreeNodeOutlet></ng-container>
</ul>
</li>
</mat-nested-tree-node>
</mat-tree>
</mat-card-content>
</mat-card>
</div>
<div class="col-sm-6 containerbackground">
<div class="col-sm-12 p-0 d-flex justify-content-center">
<img class="w-100 banner"
[src]="mListedPartyBanner">
</div>
<div class="col-sm-12">
<div class="row">
<div class="col-sm-3">
<div class="row">
<h5 class="mt-4 mb-2">Filtered Items</h5>
</div>
</div>
<div class="col-sm-5 search pt-4" fxShow="true" fxHide.gt-sm="false">
<form class="search" >
<mat-form-field class="w-100" appearance="outline">
<input type="text" #myInput matInput placeholder="Search" maxlength="50" (input)="Search(myInput.value)" autocomplete='null' [formControl]="myControl">
<button matTooltip="Search" matSuffix mat-icon-button>
<mat-icon>
search
</mat-icon>
</button>
</mat-form-field>
</form>
</div>
<div class="col-sm-4 d-flex justify-content-end">
<div class="View mt-4 mb-2 mr-4">
<div class="row">
<button matTooltip="Filter"[matMenuTriggerFor]="menu" mat-icon-button>
<mat-icon>filter_list</mat-icon>
</button>
<mat-menu #menu="matMenu">
<button (click)="sortBy(data?.id)" mat-menu-item *ngFor="let data of sortList" [value]="data?.id">
<span>{{data?.value}}</span>
</button>
</mat-menu>
<button [ngClass]="{'ActiveButton': displayMode === 1}" (click)="onDisplayModeChange(1)"
matTooltip="List view" mat-icon-button>
<mat-icon>view_headline</mat-icon>
</button>
<button [ngClass]="{'ActiveButton': displayMode === 2}" (click)="onDisplayModeChange(2)"
matTooltip="Grid view" mat-icon-button>
<mat-icon>view_module</mat-icon>
</button>
</div>
</div>
</div>
</div>
</div>
<hr>
<div class="col-sm-12" *ngIf='displayMode==1'>
<div class="row d-flex justify-content-center">
<div class="col-sm-6 p-2 " *ngFor="let prod of ListedPartyItems; let ind = index">
<mat-card class="py-1" matRipple>
<div class="corner-ribbon top-right sticky blue shadow" *ngIf='prod?.PROMO_PRICE'>
{{((prod?.PRODUCT_PRICE-prod?.PROMO_PRICE)/prod?.PRODUCT_PRICE)*100 | number: '1.0-0'}}% Off</div>
<div class="row">
<div class="ImageDiv">
<img class="w-100 Img p-1" [src]="prod['IMAGE_PATH_1']">
</div>
<div class="row NameDiv d-flex ProductData justify-content-center">
<div class="Name mt-2">
<span>{{prod?.ITEM_DESCRIPTION}}</span>
</div>
<div class="Price mt-2">
<span class="ProductPrice">{{prod?.PROMO_PRICE ? (prod?.PROMO_PRICE | number:'.1-2') :
(prod?.PRODUCT_PRICE | number:'.1-2')}}<span class="pl-1"
[innerHtml]="mCurrencyCode"></span></span>
<span class="PromotionPrice mt-1 pl-1" *ngIf='prod?.PROMO_PRICE'>{{prod?.PRODUCT_PRICE |
number:'.1-2'}}<span class="pl-1" [innerHtml]="mCurrencyCode"></span></span>
</div>
<div class="col-sm-12">
<div class="row">
<div class="d-flex justify-content-center mt-2 w-100">
<button type="button" (click)="Decrement( ind)" class="btnStyles">–</button>
<input type="text" readonly class="quantityBox" [(ngModel)]="prod.qty">
<button type="button" (click)="Increment(ind)" class="btnStyles">+</button>
</div>
<div class="col-sm-12 mt-2 d-flex justify-content-center">
<div class="row">
<div class="col-sm-6">
<button (click)="AddToCart(prod?.PRODUCT_CODE,prod?.UOM,prod?.qty, ind)"
class="col-sm-12 ProductButton " mat-raised-button>
<mat-icon class="iconSize Cursor">shopping_cart</mat-icon>
</button>
</div>
<div class="col-sm-6">
<button (click)="SelectedProduct(prod?.PRODUCT_CODE)" class="col-sm-12 ProductButton"
mat-raised-button>More</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</mat-card>
</div>
</div>
</div>
<div class="col-sm-12" *ngIf='displayMode==2'>
<div class="row">
<div *ngIf="IsItemFound" style="display:block;margin:auto;">
<img src="../../../../assets/oops.png" alt="">
</div>
<div class="col-sm-4 p-2" *ngFor="let prod of ListedPartyItems; let ind = index">
<mat-card matRipple class="p-0 ">
<div class="corner-ribbon top-right sticky blue shadow" *ngIf='prod?.PROMO_PRICE'>
{{((prod?.PRODUCT_PRICE-prod?.PROMO_PRICE)/prod?.PRODUCT_PRICE)*100 | number: '1.0-0'}}% Off</div>
<img class="d-block w-100 Img p-1" [src]="prod['IMAGE_PATH_1']">
<div class="w-100 d-flex ProductData justify-content-center">{{prod?.ITEM_DESCRIPTION}}</div>
<div class="col-sm-12 mt-2 d-flex justify-content-center">
<span class="ProductPrice">{{prod?.PROMO_PRICE ? (prod?.PROMO_PRICE | number:'.1-2') :
(prod?.PRODUCT_PRICE | number:'.1-2')}}<span class="pl-1"
[innerHtml]="mCurrencyCode"></span></span>
<span class="PromotionPrice mt-1 pl-1" *ngIf='prod?.PROMO_PRICE'>{{prod?.PRODUCT_PRICE |
number:'.1-2'}}<span class="pl-1" [innerHtml]="mCurrencyCode"></span></span>
</div>
<div class="d-flex justify-content-center mt-2">
<button type="button" (click)="Decrement( ind)" class="btnStyles">–</button>
<input type="text" readonly class="quantityBox" [(ngModel)]="prod.qty">
<button type="button" (click)="Increment(ind)" class="btnStyles">+</button>
</div>
<div class="w-100 mt-2">
<div class="row">
<div class="w-50 ">
<button (click)="AddToCart(prod?.PRODUCT_CODE,prod?.UOM,prod?.qty, ind)"
class="col-sm-12 ProductButton p-0" mat-raised-button>Add To Cart</button>
</div>
<div class="w-50">
<button (click)="SelectedProduct(prod?.PRODUCT_CODE)" class="col-sm-12 ProductButton p-0"
mat-raised-button>More</button>
</div>
</div>
</div>
</mat-card>
</div>
</div>
</div>
</div>
<div class="col-sm-3">
<mat-card class="col-sm-12 p-0 mat-elevation-z10 YourCartheight">
<mat-card-header class="d-flex justify-content-center p-2" style="background-color: #0084FF;color: white;">
<mat-card-title class="mb-0">Your Cart</mat-card-title>
</mat-card-header>
<mat-card-content>
<div class="col-sm-12" *ngIf="!IsMyCartHasItems">
<div class="row">
<div class="col-sm-12 d-flex justify-content-center mt-4">
<img class="d-block w-100 emptycart p-1" src="../../../../../assets/cart.png" alt="No Data">
</div>
<div class="col-sm-12 pb-4 d-flex justify-content-center">
<span>There are no items in your cart.</span>
</div>
</div>
</div>
<div class="col-sm-12 p-2" *ngIf="IsMyCartHasItems">
<div class="row" *ngFor="let prod of MyCart; let i = index">
<div class="col-sm-4 p-2">
<div class="col-sm-12 p-2">
<span style="font-size: 12px;">{{prod.ITEM_DESC}}</span>
</div>
</div>
<div class="col-sm-4 p-0 d-flex justify-content-center">
<div class="col-sm-12 p-2 mt-2">
<button type="button" (click)="Decrementsub(prod?.ITEM_CODE,prod?.ITEM_PACK_SIZE,prod?.TOTAL_QTY,i)" class="cartBtn">–</button>
<input type="text" readonly class="quantityBox1" [value]="prod.TOTAL_QTY">
<button type="button" (click)="Incrementsub(prod?.ITEM_CODE,prod?.ITEM_PACK_SIZE,prod?.TOTAL_QTY,i)" class="cartBtn">+</button>
</div>
</div>
<div class="col-sm-2 p-0 d-flex justify-content-center">
<div class="col-sm-12 p-2 mt-2">
<span>{{prod?.TOTAL_AMT | number}} <span class="pl-1 Price"
[innerHtml]="mCurrencyCode"></span></span>
</div>
</div>
<div class="col-sm-2 p-0 d-flex justify-content-center">
<div class="col-sm-12 p-1">
<button matTooltip="Remove"
(click)="RemoveCartProduct(prod?.ITEM_CODE,prod?.ITEM_PACK_SIZE)" mat-icon-button
color="warn">
<mat-icon>delete</mat-icon>
</button>
</div>
</div>
</div>
<div class="col-sm-12 p-0 d-flex justify-content-center">
<button (click)='GoToCheckout()' class="col-sm-12 p-0 checkout" color="warn" mat-raised-button>CHECK
OUT <strong *ngIf='mCartCount > 0' class="pl-4" style="font-size: 20px;">{{TotalAmount | number}}<span class="pl-1 Price"
[innerHtml]="mCurrencyCode"></span></strong></button>
</div>
</div>
</mat-card-content>
</mat-card>
</div>
</div>
</div>
</div>
</div>
SCSS:
.Img{
height: 200px;
#include desktop{
height: 250px;
}
}
.Caption{
font-size: 1em;
font-weight: bold;
#include desktop{
font-size: 1.5em;
}
}
.ProductButton{
background-color: color(messengerBlue);
color: color(basic);
font-weight: bold;
font-size: 1em;
border-radius: 0;
margin-left: 10px;
}
.ProductData{
font-weight: lighter;
font-size: 12px !important;
white-space: normal;
word-wrap: break-word;
color: color(gray);
}
.containerbackground{
background-color:#f1f3f6;
}
.ActiveButton{
background-color: color(primary);
color: color(basic);
}
// Change text colour when inputting text
.search {
//-----Input Field Size----------
::ng-deep .mat-form-field-flex > .mat-form-field-infix {
padding: 0.4em 0px !important;
// padding-bottom: 8px !important;
}
::ng-deep .mat-form-field-label-wrapper {
top: -1.5em;
}
::ng-deep
.mat-form-field-appearance-outline.mat-form-field-can-float.mat-form-field-should-float
.mat-form-field-label {
transform: translateY(-1.1em) scale(0.75);
width: 133.33333%;
}
::ng-deep .mat-form-field {
background-color: white;
::ng-deep .mat-form-field-wrapper {
padding-bottom: 0;
}
::ng-deep .mat-form-field-wrapper {
margin: 0 0;
}
::ng-deep .mat-form-field-outline-start,
.mat-form-field-outline-end {
border-radius: 0 !important;
}
// ::ng-deep .mat-form-field-underline {
// height: 0px;
// }
// ::ng-deep .mat-form-field-infix {
// padding-top: 0px;
// position: relative;
// }
.mat-form-field-underline {
background-color: transparent;
}
.mat-form-field-ripple {
background-color: transparent;
}
}
}
.tree-invisible {
display: none;
}
.tree ul,
.tree li {
margin-top: 0;
margin-bottom: 0;
list-style-type: none;
cursor: pointer;
}
.mat-tree-node {
min-height: 0px;
max-height: 30px;
.TreeButton{
outline: none;
}
}
.Title{
font-size: 1.5em;
font-weight: bold;
}
.banner{
height: 250px;
}
.ImageDiv{
width: 40%;
}
.Img{
height: 130px;
#include desktop{
height: 150px;
}
}
.NameDiv{
width: 60%;
.Name{
width: 100%;
text-align: center;
font-weight: lighter;
font-size: 12px !important;
white-space: normal;
word-wrap: break-word;
color: color(gray);
}
.Price{
width: 100%;
font-weight: bold;
font-size: 1.5em;
color: color(primary);
text-align: center;
}
}
.imgButton{
background-color: color(messengerBlue);
color: color(basic);
font-weight: bold;
font-size: 1em;
border-radius: 0;
}
.btnStyles{
width: 28px;
height: 28px;
background: linear-gradient(#fff, #f9f9f9);
display: inline-block;
border: 1px solid #c2c2c2;
cursor: pointer;
font-size: 16px;
border-radius: 50%;
padding-top: 1px;
line-height: 1;
}
.cartBtn{
width: 20px;
height: 20px;
background: linear-gradient(#fff, #f9f9f9);
display: inline-block;
border: 1px solid #c2c2c2;
cursor: pointer;
font-size: 12px;
border-radius: 50%;
padding-top: 1px;
line-height: 1;
}
.quantityBox{
display: inline-block;
padding: 3px 6px;
width: calc(100% - 60px);
height: 100%;
width: 46px;
height: 28px;
border-radius: 2px;
background-color: #fff;
border: 1px solid #c2c2c2;
margin: 0 9px;
font-weight: bold;
text-align: center
}
.quantityBox1{
display: inline-block;
padding: 3px 6px;
width: calc(100% - 60px);
height: 100%;
width: 25px;
height: 20px;
border-radius: 2px;
background-color: #fff;
border: 1px solid #c2c2c2;
margin: 0 9px;
font-weight: bold;
text-align: center
}
.iconSize {
font-size: 30px;
}
.cursor {
cursor: pointer;
}
.ItemPromotionPrice {
display: inline-block;
text-decoration: line-through;
opacity: .5;
font-size: 20px !important;
color: color(gray);
}
.ProductPrice{
font-weight: bold;
font-size: 1em;
color: color(primary);
}
::ng-deep .mat-form-field {
font-size: 12px; // example
}
.emptycart{
height: 100px !important;
width: 100px !important;
}
.YourCartheight{
min-height: 150px!important;
max-height:500px !important;
}
I have a suggestion to use html:not
It should be looked like this:
html:not([data-scroll='0']) /*class name for category section*/ {
position: fixed;
top: 0;
}
In order to make the middle container's content scroll, it must first overflow. That can be achieved by applying either a fixed or max height. Then you need to specify the overflow behaviour:
.containerbackground {
background-color:#f1f3f6;
max-height: 100vh;
overflow-y: auto;
}

How do I make both buttons different colors

I want too make both buttons a different collor
<header class="masthead">
<div class="container">
<div class="intro-text">
<div class="intro-lead-in">Jeroen Hooge schilderwerken</div>
<a class="btn btn-primary btn-xl text-uppercase js-scroll-trigger" href="#services">Prijs</a>
<a class="btn btn-primary btn-xl text-uppercase js-scroll-trigger" href="#services">Werkzaamheden</a>
</div>
</div>
</header>
this is the code I use, But if I change the color both buttons will change and not 1.
What it is now
what I want
You can inline style for change background for the particular button
.btn {
display: inline-block;
border: 2px solid transparent;
letter-spacing: .5px;
line-height: inherit;
border-radius: 0;
text-transform: uppercase;
width: auto;
font-family: 'Montserrat', sans-serif;
font-weight: 500;
transition-duration: 0.3s;
transition-timing-function: ease-in-out;
}
.btn-primary.active.focus, .btn-primary.active:focus, .btn-primary.active:hover, .btn-primary:active.focus, .btn-primary:active:focus, .btn-primary:active:hover, .open>.dropdown-toggle.btn-primary.focus, .open>.dropdown-toggle.btn-primary:focus, .open>.dropdown-toggle.btn-primary:hover {
color: #fff;
background-color: #204d74;
border-color: #122b40;
}
.btn-primary{
color: #fff;
background-color: #286090;
padding: 10px; 5px;
}
<header class="masthead">
<div class="container">
<div class="intro-text">
<div class="intro-lead-in">Jeroen Hooge schilderwerken</div>
<a class="btn btn-primary btn-xl text-uppercase js-scroll-trigger" href="#services">Prijs</a>
<a class="btn btn-primary btn-xl text-uppercase js-scroll-trigger" style="background:#ccc;"href="#services">Werkzaamheden</a>
</div>
</div>
</header>
Use :nth-of-type(2) to select the second btn and you can change any css property you want.
.intro-text .btn {
background: #333;
}
.intro-text .btn:nth-of-type(2) {
background: white;
color: black;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<header class="masthead">
<div class="container">
<div class="intro-text">
<div class="intro-lead-in">Jeroen Hooge schilderwerken</div>
<a class="btn btn-primary btn-xl text-uppercase js-scroll-trigger" href="#services">Prijs</a>
<a class="btn btn-primary btn-xl text-uppercase js-scroll-trigger" href="#services">Werkzaamheden</a>
</div>
</div>
</header>
simply give an ID to tag so that it can be identified uniquely
#black{
background-color: black;
display: block;
}
#brown {
background-color: brown;
display: block;
}
<header class="masthead">
<div class="container">
<div class="intro-text">
<div class="intro-lead-in">Jeroen Hooge schilderwerken</div>
<a id="black" class="btn btn-primary btn-xl text-uppercase js-scroll-trigger" href="#services">Prijs</a>
<a id="brown" class="btn btn-primary btn-xl text-uppercase js-scroll-trigger" href="#services">Werkzaamheden</a>
</div>
</div>
</header>
`
Add to classes. One general for all the a tags. And one for the :first-of-type
.intro-text a:first-of-type{
background-color: red;
color: white;
display: block;
}
.intro-text a {
background-color: blue;
color: white;
display: block;
}
<header class="masthead">
<div class="container">
<div class="intro-text">
<div class="intro-lead-in">Jeroen Hooge schilderwerken</div>
<a class="btn btn-primary btn-xl text-uppercase js-scroll-trigger" href="#services">Prijs</a>
<a class="btn btn-primary btn-xl text-uppercase js-scroll-trigger" href="#services">Werkzaamheden</a>
</div>
</div>
</header>
You can use those classes available in Bootstrap buttons as example below or create your own classes.
<header class="masthead">
<div class="container">
<div class="intro-text">
<div class="intro-lead-in">Jeroen Hooge schilderwerken</div>
<a class="btn btn-default btn-xl text-uppercase js-scroll-trigger" href="#services">Prijs</a>
<a class="btn btn-warning btn-xl text-uppercase js-scroll-trigger" href="#services">Werkzaamheden</a>
</div>
</div>
</header>