Is your browser displaying dimensions different from the ones specified in the CSS?

On my webpage, I have defined the header and leftpane as div. The specified height of header is 116px, and the width of leftpane is 181px. However, upon inspecting the page using chrome-developer-tool, the displayed height and width are 98.36px and 165.41px respectively instead of the original values set in the CSS.

The issue with the height is illustrated in the following image: https://i.sstatic.net/gGgqX.png

The problem with the width can be seen in this image: https://i.sstatic.net/BdZ4u.png

Here is the relevant CSS code:

.dashboard-header {
  background: #000000;
  height: 116px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-around;
}
.dashboard-leftpane {
  width: 181px;
  background: #000000;
  height: 100%;
}

Corresponding HTML code:

<div class="input-search">
    <img class="imgage-search" src="search.svg" alt="Grace Logo">
    <input type="text" name="" value="" placeholder="" style="border:none; background: #FAFAFA; flex-grow: 2;">
    <img class="imgage-search" src="filter.svg" alt="">
</div>

<div class="profile-menu">
    <span class="profile-menu-name">USER</span>
    <img src="arrow_drop_down.svg" alt="">
</div>
<div class="dashboard-leftpane">

    <div class="giraffe-list">
      <div class="giraffe-list-item">
          <span class="giraffe-item-name">ITEM1</span>
      </div>

      <div class="giraffe-list-item">
          <span class="giraffe-item-name">ITEM2</span>
      </div>

      <div class="giraffe-list-item">
          <span class="giraffe-item-name">ITEM3</span>
      </div>

      <div class="giraffe-list-item">
          <span class="giraffe-item-name">ITEM4</span>
      </div>

      <div class="giraffe-list-item">
          <span class="giraffe-item-name">ITEM5</span>
      </div>
    </div>

</div>

Answer №1

Perhaps this could solve the issue: ensure that your divs have box-sizing: border-box applied.

If the problem persists, it might be due to the presence of display: flex;

Is it essential to utilize display: flex;?

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

Organize objects neatly in a grid formation

I have a .test div with grid-template-columns: auto auto auto;. The column width is set to vary based on the element width, and I also used justify-content: start; to align the columns to the left. I chose to use auto instead of 1fr to prevent the columns ...

How can I align the logo in the center of a ul

Many have attempted to resolve this issue, creating makeshift solutions or simply settling for an outcome that just "gets by." But what is the optimal approach? I have nearly finished something, yet for some reason, the logo isn't centered, rather the ...

Find the second element beneath the mouse cursor that is not a direct ancestor of the first element

I am currently developing a card drag-and-drop board using HTML5 inspired by Trello. My focus right now is on connecting the lists to specific list slots/containers. My challenge lies in determining which list container is positioned beneath the mouse po ...

Turning off FavIcon.ico Can Enhance Performance

element: Currently, I have two websites being hosted on AEM or cq5 with distinct domains. Both websites share the same favicon on the new domain. I have attempted to remove this in the head.jsp template, but the favicon continues to display. Despite remo ...

CSS: Struggling to properly position two flex items

I'm having some trouble with the alignment in my flex container. The title is perfectly centered, but the breadcrumb content is not aligning correctly. Specifically, I want the breadcrumbs to be right-aligned and positioned 25px from the top within t ...

Using jQuery, Ajax, and HTML together can create dynamic

Is there a way to run JavaScript functions in an HTML file that is loaded using AJAX? The HTML file contains both text and JavaScript, but only the inline JavaScript seems to work (like onclick="dosomething();return false"). The pre-defined functions wra ...

Arranging HTML elements using Jquery sorting

Possible Duplicate: How can I alphabetically sort a list using jQuery? Technology: Asp.net with jQuery. Hello everyone, Summary: I am relatively new to jQuery and have been working on a script that allows the Enter key to move to the next input elem ...

Tips for positioning a DIV element in the middle of the available empty space using Bootstrap version 5.1

As a beginner in front-end development, I'm currently working on my website to showcase my Blockchain projects. Right now, my goal is to align the text "Technology is my Passion" in the center of the remaining free space. How can I achieve this with ...

Exploring the process of implementing smooth transitions when toggling between light and dark modes using JavaScript

var container = document.querySelector(".container") var light2 = document.getElementById("light"); var dark2 = document.getElementById("dark"); light2.addEventListener('click', lightMode); function lightMode(){ contai ...

What is the best way to retrieve both the start and end date values from a React date range picker component

I have integrated a date range picker npm package called react-date-range into my code. On my screen, there is an "Apply Dates" button. When this button is clicked, I want to retrieve the selected date range value. How can I achieve this onclick event? ...

Achieving automatic div width using CSS

I am dealing with an HTML structure that can vary depending on the page context. In some instances, it appears like this: <div class="container"> <div class="column"> blah </div> </div> While on other pages, it looks l ...

"Maximizing Bootstrap Grid System in Bootstrap Modals: A Step-by-Step Guide

I am currently working with Bootstrap 5 modal. I am attempting to implement the Bootstrap grid system inside the modal, however, I am experiencing unwanted margins between the modal body and the grids. How can I remove these margins? Any assistance on t ...

What is the best way to implement a link that triggers a chat box in HTML?

Hello, I need some assistance with an HTML project. I am attempting to create a hyperlink that displays as a group of words, and when clicked, triggers a pop-up message. Additionally, I would like to have control over the content displayed in the pop-up ...

What is the best way to retrieve the file and directory tree structure from git using php?

I am looking to streamline the process of downloading zip files from my public git repository on Bitbucket. Rather than manually creating a download button for each zip file, I want to dynamically generate a PHP page that displays all available zip files a ...

Alignment of React page gets messed up upon inclusion of Gallery component

I have searched for solutions online, but nothing seems to work for me. I am facing an issue with my webpage that has multiple sections, and I want to display them one after the other vertically. Here is the code snippet: import React from 'react&ap ...

The border in my HTML table is not displaying when I run my flask application

My flask application was running smoothly in a virtual environment until I encountered an issue with the html borders not showing up. Even after seeking help from a friend who knows some html, the problem still persists. app.py: from flask import Flask, r ...

Ways to add a CSS class to an ID that immediately follows

I've been working on an editable table using the HTML5 attribute contenteditable. Everything was going smoothly until I had an idea to highlight the cell that was just updated by adding a class called alert-danger from Bootstrap. Once a cell is succe ...

Ways to align a bootstrap 4 row both vertically and horizontally in the center amidst other rows

Assume there is a main menu followed by three rows. The first row should be at the top and the third at the bottom, while the second row needs to be centered both vertically and horizontally. As you scroll down, the main menu should be able to hide while ...

trouble with the layout of the table

Could you assist me in improving the design to enhance data clarity? Your help would be greatly appreciated. Thank you for your anticipated response. CSS File: table-layout: fixed; width: 100%; border-collapse: collapse; table-layout: fixed; ove ...

Expand or collapse in a sequential manner

Is there a way to ensure that only one table row expands at a time, causing the others to collapse? Any suggestions on achieving this? Here's the HTML code snippet: <table class="table"> <tbody> <tr class="parent" id="2479"> ...