Eliminating the vertical scroll on a webpage with the help of Bootstrap 5's responsive design capabilities

I've been tasked with converting a Figma design into an HTML page using Bootstrap 5. Take a look at the Figma design:

https://i.sstatic.net/jo5Si.png

However, there's an issue causing a vertical scroll bar to appear on the page. The culprit seems to be the highlighted area in the red box shown here:

https://i.sstatic.net/iDm32.png

The height of the image inside the col div is not triggering vertical overflow. How is the column height determined?

https://i.sstatic.net/bZotC.png

I've attempted adjusting the height of the image div, but that results in making the image too small. I want to understand how the div height is set automatically when utilizing responsive row/col classes.

Below is the code snippet I've worked on:

@import url("https://fonts.googleapis.com/css2?family=Poppins&display=swap");
body {
  font-family: "Poppins", sans-serif;
  h4 {
    font-weight: 600;
  }
  .left-col {
    padding-top: 200px;
  }
  input[type="text"] {
    background-color: #f0efff;
    height: 62px;
  }
  ...
}
<!DOCTYPE html>
<html lang="en">
...
            <div class="row justify-content-center">
            <div class="col-auto p-1">
              <a href="#" class="btn btn-round">
                <img
                  src="/login-1/assets/logos/facebook-icon.png"
                  alt="Facebook Icon"
                />
              </a>
    </div>
    <div class="col-auto p-1">
      <a href="#" class="btn btn-round">
        <img src="/login-1/assets/logos/apple-icon.png" alt="Apple Icon" />
      </a>
    </div>
    <div class="col-auto p-1">
      <a href="#" class="btn btn-round">
        <img src="/login-1/assets/logos/google-icon.png" alt="Google Icon" />
      </a>
    </div>
    </div>
    </div>
    </div>
    </div>
</body>

</html>

View the code on CodePen for more details: https://codepen.io/junaidaslam/pen/WNYRRzK?editors=1100

Answer №1

Have you tried this approach?
<div class="container px-5">
   <div class="row justify-content-around align-items-center" style="
      height: 90vh;
      ">
      <div class="col-md-8 left-col">
         <div class="mb-4">
            <h1 style="font-weight: bold;" class="py-2">Sign in to</h1>
            <h4 style="font-size: 35px;">Lorem Ipsum is simply</h4>
         </div>
         <div class="d-flex py-4">
            <div class="pt-2" style="font-size: 16px;">
               If you don’t have an account register.<br>
               You can
               <span class="text-primary" style="font-weight: bold;">Register here!</span>
            </div>
            <div>
               <img src="/assets/images/saly-14.png" alt="image" class="" style="
                  position: absolute;
                  top: 395px;
                  width: 15%;
                  ">
            </div>
         </div>
      </div>
      <div class="col-md-4 right-col">
         <h4 class="mb-4">Sign in</h4>
         <form>
            <div class="mb-4 form-group">
               <input class="form-control px-3 border-0" type="text" name="Email" placeholder="Enter email or user name">
            </div>
            <div class="mb-3 form-group">
               <input class="form-control px-3 border-0" type="text" name="Password" placeholder="Password">
            </div>
            <div class="mb-5 form-group text-end"><a href="#" class="text-decoration-none ">Forgot Password?</a></div>
            <div class="form-group">
               <input type="submit" value="Login" class="btn btn-primary btn-login w-100">
            </div>
         </form>
         <div class="form-text continue-with text-center py-5">
            or continue with
         </div>
         <div class="row justify-content-center">
            <div class="col-auto p-1">
               <a href="#" class="btn btn-round">
               <img src="/assets/logos/facebook-icon.png" alt="Facebook Icon">
               </a>
            </div>
            <div class="col-auto p-1">
               <a href="#" class="btn btn-round">
               <img src="/assets/logos/apple-icon.png" alt="Apple Icon">
               </a>
            </div>
            <div class="col-auto p-1">
               <a href="#" class="btn btn-round">
               <img src="/assets/logos/google-icon.png" alt="Google Icon">
               </a>
            </div>
         </div>
      </div>
   </div>
</div>

Answer №2

After reviewing the code, I have made some modifications to remove padding from left-col and right-col. This should help address the issue of space consumption and scroll generation.

@import url("https://fonts.googleapis.com/css2?family=Poppins&display=swap");

body {
  font-family: "Poppins", sans-serif;

  h4 {
    font-weight: 600;
  }

  .left-col {
    
  }

  input[type="text"] {
    background-color: #f0efff;
    height: 62px;
  }

  input[type="text"]:focus {
    background-color: #f0efff;
    border-radius: 10%;
  }

  input::-webkit-input-placeholder {
   
  }
  input::-moz-placeholder {
    
  }
  input:-ms-input-placeholder {
   
  }
  input:-moz-placeholder {
   
  }

  a {
    font-size: 13px;
  }

  .continue-with {
    font-size: 16px;
    clear: #b5b5b5;
  }

  .btn-login {
    height: 60px;
    border-radius: 10px;
  }

  .btn-round {
    border-radius: 50%;
    height: 40px;
    padding: 0;
  }

  .btn-round img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .image {
    position: relative;
    bottom: 10%;
    height: 75%;
    right: 5%;
  }

  .right-col {
    
   
  }

  .btn-primary {
    background-color: #4d47c3 !important;
  }

  .text-primary {
    color: #4d47c3 !important;
  }
}
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Login 1</title>
  <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="21434e4e55525553405161140f110f13">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous" />
  <link href="./login-1.css" rel="stylesheet" />
</head>

<body>
  <nav class="navbar">
    <div class="container-fluid">
      <a style="font-weight: bold" class="navbar-brand text-dark text-decoration-none" href="#">Your logo</a>
    </div>
  </nav>
  <div class="container px-5">
    <div class="row">
      <div class="col-md-8">
        <div class="row mb-4">
          <div class="col">
            <h1 style="font-weight: bold" class="py-2">Sign in to</h1>
            <h4 style="font-size: 35px">Lorem Ipsum is simply</h4>
          </div>
        </div>
        <div class="row py-4">
          <div class="col-md-5">
            <div class="pt-2" style="font-size: 16px">
              If you don’t have an account register.<br />
              You can
              <span class="text-primary" style="font-weight: bold">Register here!</span>
            </div>
          </div>
          <div class="col-md-7">
            <img src="https://raw.githubusercontent.com/jaslam94/figma-exercises/main/login-1/assets/images/saly-14.png" alt="image" class="image" />
          </div>
        </div>
      </div>
      <div class="col-md-4">
        <h4 class="mb-4">Sign in</h4>
        <form>
          <div class="mb-4">
            <input class="form-control px-3 border-0" type="text" name="Email" placeholder="Enter email or user name" />
          </div>

          <div class="mb-2">
            <input class="form-control px-3 mb-2 border-0" type="text" name="Password" placeholder="Password" />
            <a href="#" class="text-decoration-none form-text float-end" style="color: #b5b5b5">Forgot Password?</a>
          </div>

          <div class="d-grid gap-2 mt-5">
            <input type="submit" value="Login" class="btn btn-primary btn-login shadow-lg" />
          </div>
        </form>
        <div class="form-text continue-with text-center py-5">
          or continue with
        </div>
        <div class="row justify-content-center">
          <div class="col-auto p-1">
            <a href="#" class="btn btn-round">
              <img src="/login-1/assets/logos/facebook-icon.png" alt="Facebook Icon" />
            </a>
          </div>
          <div class="col-auto p-1">
            <a href="#" class="btn btn-round">
              <img src="/login-1/assets/logos/apple-icon.png" alt="Apple Icon" />
            </a>
          </div>
          <div class="col-auto p-1">
            <a href="#" class="btn btn-round">
              <img src="/login-1/assets/logos/google-icon.png" alt="Google Icon" />
            </a>
          </div>
        </div>
      </div>
    </div>
  </div>
</body>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to customize the appearance of a non-current month cell within the date picker?

I'm currently in the process of developing a registration form for my JavaFX application. I am faced with an issue where I need to disable certain cells in the date picker when they do not belong to the displayed month. Let's take a look at my cu ...

When receiving a GET response after a server crash

Question: I am sending a Get request through Ajax every second and waiting for a response from the server. However, if my application crashes and I keep sending requests every second, I only receive a server timeout error (HTTP status code 502) with no oth ...

Only one condition is met when using the Javascript if statement with the :checked and .bind methods

I need help creating an Override Button to disable auto-complete for a form using Javascript. I want the div "manualOverrideWarning" to display a warning if the button is selected, but my current function only works the first time the user presses the butt ...

Showing identification on the drop-down list

Within my dropdown menu setup, I am aiming to achieve a specific functionality. When the user clicks on sub menu, I want the title of sub menu to display in the Menu space as illustrated below. What steps can be taken to accomplish this? UPDATE: After fu ...

Ways to modify the text of an HTML element when hovering over it

One of my elements contains the text &times; within a <span>. Is there a way to change this symbol to something else, like &infin;, when hovered over? <span class="change-text">&times;</span> When the mouse hovers over it, I ...

When the width of the element is set to 100vw, it disrupts the

I'm attempting to expand a sticky element to fit the size of the screen. Here is the HTML code I am using: .large { height: 200vw; width: 200vw; } .header { left: 0; top: 0; color:white; position: sticky; width: 100px; height: 10 ...

I'm wondering if anyone has any insights as to why the CSS rule `body{ overflow: auto;}` is not functioning properly for me. Despite my attempts of adding a class to the body tag and

I am facing an issue where adding body tags to my code in Visual Studio code does not yield the desired results. Interestingly, it doesn't seem to be a syntax error in CSS. body{ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI&apo ...

Stop the webpage from scrolling when clicking on a ui-grid field

Is there a way to prevent page scrolling when clicking on a row field in ui-grid? I'm working with a page that has ui-grid, and each row includes an anchor tag with a URL value linked and target="_blank" to open in a new tab like the example below: ...

What is the process of implementing a tree view hierarchy in PHP using CodeIgniter?

I have an array structured like this: Array ( [0] => Array ( [id] => 1 [child_name] => "Emma" [parent_name] => "Mr Brown" ) [1] => Array ( [id] => 2 ...

The component next/image is experiencing issues when used in conjunction with CSS

I struggled to create a border around an image because the custom CSS I wrote was being overridden by the Image component's CSS. Despite trying to leverage Tailwind and Bootstrap to solve the problem, my efforts were unsuccessful. Now, I am at a loss ...

"Hiding elements with display: none still occupies space on the

For some reason, my Pagination nav is set to display:none but causing an empty space where it shouldn't be. Even after trying overflow:hidden, visibility:none, height:0, the issue persists. I suspect it might have something to do with relative and ab ...

Tips for Aligning Text Vertically in the Center of a Grid using Bootstrap 5

Currently using Bootstrap version 5.1.3 and here is a snippet of my HTML code: <!DOCTYPE html> <html lang="vi"> <head> <meta charset="UTF-8> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="v ...

Attempting to implement a polygon-shaped button with material-UI and React framework

https://i.sstatic.net/Nlxrr.jpg This is a design I am experimenting with for the poly button above. I have tried various styling methods. Does anyone have any ideas? ...

Instead of stacking neatly, the Bootstrap rows are overlapping each other

I am currently working on a webpage design using bootstrap. The layout consists of different sections, each containing a bootstrap row within a container. However, I encountered an issue where new rows are not appearing below the previous row as expected, ...

Limit the height of a collapsed accordion section in Bootstrap 5 using Vue3

I'm currently in the process of building a web app using Vue3 and Bootstrap 5. However, I seem to be facing an issue that is specific to Bootstrap. My goal is to limit the height of the collapsed accordion segment so that it doesn't push the othe ...

The data-src tags are functioning properly in the index.html file, but they are not working correctly in angular

I'm still learning about Angular and JavaScript, so please bear with me if my questions seem silly. I've been trying to add a theme to my Angular project. When I include the entire code in index.html, everything works fine. However, when I move ...

Select a different radio button to overwrite the currently checked one

I am facing a situation where I have two radio buttons. The default checked state is one of them, but I want to change that and make the other one checked by default instead. Here is the HTML code: <div class="gui-radio"> <input type="radio" v ...

Tips for keeping a div visible while hovering over a link using only CSS

Apologies for any language errors in advance. I will do my best to explain my issue accurately: In my CSS, I have created a hidden div that is displayed none by default. When I hover over a link in the navigation bar, I change the display to block, creati ...

Tips for updating the id of a tag using JavaScript?

Html Code:- {% for post in posts %} <article class="media content-section"> <div class="media-body"> <h2><a id="post_title" class="article-title" href="{% url 'post-detail' post.slug %}">{{ post.title }}&l ...

Animating CSS styles in Vue.js based on JavaScript triggers

Within my Vue.js application, I've implemented a login form that I'd like to shake whenever a login attempt fails. Though I have achieved the desired shaking effect, I'm not completely satisfied with my current solution. Here's a simpl ...