How can I prevent the background image to overflow so that the horizontal scroll bar wont appear? The layout of this page is two columns which the width of each part will be 50-50, the left part will be the login form and the right side will be the background image and logo. I also used bootstrap 5.3.
Here’s the code:
<!DOCTYPE html>
<html lang="en">
<head>
<?php include_once './include/head.php'?>
<title>Login</title>
<style>
.login-form-section {
display: grid;
place-items: center;
}
.photo-logo-section {
background-image: url("./assets/images/bu-bg.jpg");
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
overflow: hidden;
}
#dark-hue {
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.5);
mix-blend-mode: multiply;
}
</style>
</head>
<body>
<main class="row" style="height: 100vh;">
<section class="login-form-section col-lg-6">
<form action="" method="post">
<div class="form-group w-100">
<label for="email">Email</label>
<input type="email" id="email" name="email" class="form-control" required>
</div>
</form>
</section>
<section class="photo-logo-section col-lg-6">
<div id="dark-hue"></div>
</section>
</main>
</body>
</html>
2
Answers
I solved it somehow by adding a 'container-fluid' class on the and added a div that has a 'row' class.
Here's the code:
The problem is not the image but the default gutter included by Bootstrap with the
.row
classname. You can remove these gutters by adding.g-0
classname along with the.row
:Here is an example that works. Be sure to view the example in full screen mode: