What could be causing the child div to be out of alignment?

It appears that I'm missing something fundamental about CSS. Take a look at this example on CodePen:

/* Reset */
*,
*::after,
*::before {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  margin-block-start: 0;
  margin-block-end: 0;
}

.parent {
  width: 5rem;
  height: 3rem;
  border: 3px solid green;
}

.child {
  width: 5rem;
  height: 3rem;
  border: 3px solid blue;
}
<div class="parent">
  <div class="child"></div>
</div>

This is the outcome:

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

Given that there are no paddings or margins, why is there a thin white space between the two borders?

Answer №1

It appears that there is a display anomaly occurring in browsers based on Chromium. I was able to replicate the problem in both Chrome and Edge when zoomed in at 250%, and also in the code pen at 125% zoom level (running the current stable version, MacOS 12.0.1, ARM).

To address this issue, I have submitted a bug report in the chromium bug tracker: https://bugs.chromium.org/p/chromium/issues/detail?id=1275530

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 makes the behavior of (display: flex) similar to that of an inherited property?

One thing that puzzles me is the behavior of the display property in CSS. Why is it that setting {display: flex} for a div will apply this style to all nested p elements within the div? It seems like {display: flex} might be an inherited property, but I&ap ...

unexpected alteration of text sizing in mathjax within reveal.js presentations

Something strange is happening with the font size in my slides. The code for each slide is the same, but there is an unexpected change between the 3rd and 4th slide. I cannot figure out what is causing this discrepancy. Oddly enough, when I remove the tit ...

Looking to position content within a card to the bottom right in Bootstrap 4

Having trouble aligning my text and button within a card to the bottom right. Can't seem to get them to line up correctly. https://i.sstatic.net/OTDwJ.jpg This is what I have in my code: <div class="col-sm-3 text-right my-auto"> <div cl ...

There seems to be an issue with Jekyll where it is failing to generate HTML for Markdown pages

I recently delved into the world of Jekyll to transfer my blog over to GitHub Pages. Utilizing a local Jekyll tool (jekyll 3.1.3) with the neo-hpstr-jekyll-theme as a starting template on my Windows system. While the entry point (index.html in root) and p ...

Determine whether a child element is missing a certain class

I am currently investigating whether a child element lacks a specific class. The elements in question are: <g id="note1"> <path id="Barline1" d="M55.837,19.278h0.249c0.11,0,0.199,0.089,0.199,0.199V40.56c0,0.11-0.089,0.199-0.199,0.199h-0.249c ...

Tips for traversing a list of elements that has become stale due to a webpage refresh

Hey there, I'm facing a challenge while trying to iterate over buttons that lead to new pages and then going back to click on the next button in the list. It's like navigating through a graph tree where every node needs to be accessed. Here is h ...

Is it possible for me to include a static HTML/Javascript/jQuery file in WordPress?

My extensive HTML file contains Javascript, jQuery, c3.js, style.css, and normalize.css. I am wondering if I can include this file as a static HTML page within Wordpress. Say, for instance, the file is called calculator.html, and I want it to be accessib ...

Using Flexbox to center items is leading to content overlapping

After attempting to utilize flexbox for centering items, I am encountering issues with content overlapping and misalignment. https://i.sstatic.net/48PMj.jpg Link to the code snippet .footer_3 { position: relative; display: flex; align-items: top; ...

Bootstrap's versatile footer positioning adaptation

I am working with a simple layout design: +----------+ | Header | +----------+ | | | Content | | | +----------+ | Footer | +----------+ My goal is to ensure that the footer is positioned: at the bottom of the viewport when there ...

Align Divs to Create a Centered Webpage

Allow me to preface this question by confessing that I am a self-taught (novice) web developer (and not very skilled at it). For a while now, I have been struggling to find an efficient method of centering web pages using AP Divs. I've experimented wi ...

Show a table when a button is clicked using Javascript

Undertaking a project called: Tennis Club Management involving javascript, HTML, CSS, and bootstrap. The project includes a Login Page (index.html) and a Manage Players Page (managePlayers.html). Within the managePlayers.html, there are two buttons - Add P ...

Eliminating the unwanted line breaks that are automatically inserted when integrating JavaScript with HTML code

Hey everyone, I'm new to web development and could really use some assistance. I am currently working on a website that shows the weather forecast for the next four days, using SimpleWeather.js. In my JavaScript, I want to display the High & Low temp ...

Using jQuery within MediaWiki pages beyond just Monobook.js or extensions is a powerful tool

Currently, I am experimenting with some jQuery functionalities in a MediaWiki content page to enhance various features. I have referred to the following resources: http://www.mediawiki.org/wiki/Manual:$wgRawHtml (particularly for incorporating Paypal but ...

Determining the precise mouse location within child elements regardless of zoom level, scrolling, or dimension changes

My goal is to accurately determine mouse coordinates within the page elements. To see the code in action, please visit: http://jsfiddle.net/t8w9k6gu/ $('#p1, #p2, #p3').on('click mousemove touchmove', function(ev){ var target = ...

Conceal a Drawer Beneath a Curved Header Using Material UI and Custom CSS Sty

I am facing a challenge with my menu that needs to be concealed behind an arch design. https://i.sstatic.net/CwdjJ.png The objective is for the menu to appear hidden behind the black area, while still being visible over the blue arch in the background (a ...

Display information using HTML elements within a loop in JavaScript

I am facing an issue with iterating over an array of objects in JavaScript. Each object contains multiple parameters, and my goal is to extract the data from each object and display it in a table or a grid format. Here is an example of my code: function ...

The submission function in document.forms is causing my webpage to freeze

I have been working on a website to manage an SQL table and I encountered a situation where I needed to reload the page with new variables. To achieve this, I created a form named "rerouter" with hidden textareas and set the action to the current page (in ...

Utilizing CSS inheritance in React app to style multiple classes simultaneously

My app features two buttons that serve similar functions on different pages. One button directs users to the search page, while the other takes them back to the home page. The challenge I'm facing is that I need the background image for each button t ...

Expanding text area size dynamically in Nuxt3 using Tailwind CSS

Is there a way to expand the chat input field as more lines are entered? I want the textarea height to automatically increase up to a maximum of 500px, and adjust the height of .chat-footer accordingly. Below is a snippet of my code. <div v-if="ac ...

I'm currently working on building a form with the Angular framework, but I'm facing a challenge in displaying all the

I am having trouble with my Angular form as I am only able to display two fields when the page is loaded. Code snippet from Component.html: <div class="card m-3"> <div class="card-body"> <form [formGroup]="surveyFor ...