The row does not completely occupy the entire width of the container

My goal is to design a container using Bootstrap. I have successfully added a name and button at the top of the container as a row, set a background color, and included a border. However, there seems to be an issue with the width of the border compared to the row. On the right side, the border appears disconnected from the row, leaving a gap that doesn't complete the overall "window" effect. I have also attached a picture and included my code below.

 <div
          class="container"
          style="border-radius: 5px; border: 2px solid #98bcdb;border-top-style: hidden; "
        >
          <div
            class="row"
            style="
              background-color: #337ab7;
              border: 3px solid #337ab7;
              border-radius: 5px 5px 0px 0px;
              color: white;
              height: 40px;
              padding: 5px;
            "
          >
            <div class="col-6">
              Dokumenty
            </div>
    
            <div
              class="col-6"
              style="
                display: flex;
                justify-content: flex-end;
                align-items: baseline;
              "
            >
              <i class="fa-solid fa-plus"></i>
              Připojit soubor
            </div>
          </div>
          <br />
    </div> 

Initially, the border was detached at the top as well, but I managed to fix that by removing the top section of the border. While it looks better now, the issue on the right side still persists.

Answer №1

After spending a good 10 minutes troubleshooting why the border of my container was displaying as 1.9px instead of 2px, resulting in a tiny gap between it and its child element, I finally realized that my browser's zoom was set to 90%. Maybe this could be the issue on your end too? Other than that, everything seems to be working fine:

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

.container
{
  border-radius: 5px;
  border: 2px solid #98bcdb;
  overflow: hidden; /* added to hide square corners of the child */
}

.row
{
  background-color: #337ab7;
  border: 0px solid #337ab7;
/*  border-radius: 5px 5px 0px 0px;*/
  color: white;
  height: 40px;
  padding: 5px;
}

.col-6.right
{
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
}
<div
      class="container"
    >
      <div
        class="row"
      >
        <div class="col-6">
          Documents
        </div>

        <div
          class="col-6 right"
        >
          <i class="fa-solid fa-plus"></i>
          Attach File
        </div>
      </div>
      <br />
</div>

Additionally, I removed the border radius for the child element to ensure consistency with the parent by hiding overflow within the container.

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

Extra brackets appear when retrieving JSON data

In my code, I am attempting to extract data from a JSON file. The JSON data does not have any brackets, just an array separated by commas. However, when I retrieve the data using $scope, an extra square bracket is added outside of my output. Here is a demo ...

Incorporate a Captcha image into your Laravel application without the need for any additional packages

After successfully uploading a laravel app, my boss requested that I add a captcha image to the website. However, all the captcha techniques for Laravel I've researched require installing a package, and I'm hesitant to reupload the entire website ...

What is the best way to use SQL and Flask to automatically fill out a form based on a selection made from a

Looking for assistance with populating an HTML form by selecting a company from a dropdown menu. The desired result is similar to the example found here, using SQL and Flask. I'm unsure of how to retrieve the selected value from the <option> ta ...

How to turn off spin buttons for input type=“number” in AngularJS when using webkit

Although similar advice can be found for 'normal' Bootstrap, the solution may not be the same for AngularJS. input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: ...

Guide on triggering a bootstrap popup modal using a TypeScript file

I am currently working on an Angular project where I need to launch a popup modal when my function is called. I came across an example on w3schools, but it only contains the HTML logic to open the popup. What I want to achieve is to open the popup from th ...

Understanding and processing HTML strings in typescript

I am currently utilizing TypeScript. Within my code, there is an object named "Reason" where all variables are defined as strings: value, display, dataType, and label. Reason = { value: '<ul><li>list item 1</li><li&g ...

Which is the better option for opening a link in a button: using onclick or href?

What is the most effective way to open a link using a button? <button type="button" onclick="location='permalink.php'">Permalink</button> <button type="button" href="index.php">Permalink</button> ...

Adjusting offcanvas height in Bootstrap based on content

.cursor-pointer { cursor: pointer; } <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="690b06061d1a1d1d09c13c809e9afbcfc1792efeff8">[email protected]</a>/dist/js/bootstr ...

Obscured by the overflow

How can I make my navbar stay sticky at the top all the time while scrolling without the content of my cards overlapping it? I am using Bootstrap 5 and have tried setting the position to sticky and overflow to hidden, but the issue persists. Any suggestion ...

Utilize data attributes in VueJS to dynamically style elements

Is there a way to utilize the data() values within the <style>..</style> section? I have experimented with different combinations (using/omitting this, with/without {{brackets}}, etc.) but haven't been successful. Interestingly, when I man ...

React MDBootstrap is experiencing a flickering issue with the input field

While attempting to create a login form, I encountered an issue where the entire page flickers when focusing on the input field. Below is the code for rendering: render() { return ( <div> <div className="row"> ...

Using HTML5 History API to navigate backwards without allowing the user to move forward (can popState?)

My webpage showcases user information with the help of AJAX for seamless data modification without altering the page layout. The process is straightforward: - Users can view their data when they access their profile. - By clicking the Edit button, a form ...

Issue with Editing the Layout of a Recently Created Page in Django CMS

I am brand new to the world of Django CMS and currently facing an issue that has me stuck. After adding a new module to an existing Django project and creating a new HTML page, I encountered a challenge with the templates configuration in settings.py. TEM ...

Creating a hover state for a CSS class seems straightforward, but I'm finding it a bit tricky

I am looking to customize my inline menu by changing the last menu item to a different colored box with unique text. I have successfully applied a custom style using the #navbar a.blogbox class, but I am struggling to figure out how to change the hover s ...

The auto-play feature fails to function on iPhone devices when using Reactjs

I am currently working with Reactjs and Nextjs. I have a video on my website that is functioning properly on Android phones but not on iPhones. How can I resolve this issue? I have attempted the following code: <video loop autoplay='' muted> ...

The application of border-radius to a solitary side border forms a unique "crescent moon" shape rather than a traditional semi-circle

Is there a way to transform this shape into a regular semicircle, avoiding the appearance of a moon, and change the image into a circle rather than an ellipsis? http://jsfiddle.net/226tq1rb/1/ .image{ width:20%; border-radius:500%; border-rig ...

Refresh the content of an iframe (local HTML) by clicking on buttons

When a user clicks on a button, I am loading an HTML file into a DIV (iframe). The issue arises when the user clicks another button and wants to reload the iframe with a different HTML file. This is the current code snippet: <script type="text/javasc ...

Why does Froala Editor not maintain formatting when retrieving data from the database?

I've been using the Froala editor to add content on my website, and it's doing well for inserting data into the database. However, I'm facing an issue when retrieving data from the database as it doesn't maintain the original formatting ...

Identify Bootstrap modal to modify destination of keypress input

I am working on a piece of code that detects keypress events and focuses input towards a searchbar with the id "search". $( document ).keypress(function() { $("#search").focus(); In addition, I have a bootstrap modal dialog containing input fields ...

Alignment Troubles with Icons

I am having trouble positioning some icons on the far right of my 960 grid template header, next to my logo which is on the far left. I have tried multiple ways but can't seem to get it right. Any assistance would be greatly appreciated. Below is the ...