Eliminate spaces between divs without any margins or padding

In my HTML code, I have two divs with different classes - mini-date-holder and mini-event-holder.

Even though both of these divs are set to have no margin or padding, they are still displaying with a gap between them. I'm struggling to understand why this is happening.

Does anyone know the reason for this gap and how I can remove it?

I would like the three dots to appear directly below the number without any space in between.

I am aware that I could potentially use something like transformY, but I want to first determine the root cause of this rendering issue.

You can take a look at the provided JSFiddle link for reference or check out the code snippet below.

.mini_date {
  flex: 1;
  text-align: center;
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-weight: 400;
}
.mini-event {
  width: 4px;
  height: 4px;
  background: red;
  border-radius: 2px;
  float: left;
  margin-left: 3px;
  margin-right: 3px;
}
.mini-event-holder {
  margin: 0 auto;
  height: 4px;
  display: inline-block;
  margin: 0px;
  padding: 0px;
}
.mini-date-holder {
  margin: 0px;
  padding: 0px;
}
<div class="mini_date">
  <div class="mini-date-holder">10</div>
  <div class="mini-event-holder">
    <div class="mini-event"></div>
    <div class="mini-event"></div>
    <div class="mini-event"></div>
  </div>
</div>

Answer №1

.mini_date{
flex: 1;
text-align: center;
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
font-weight: 400;
}
.mini-event{
width: 4px;
height: 4px;
background:red;
border-radius: 2px;
float: left;
  margin-left: 1px;
  margin-right: 1px;
}

.mini-event-holder{
margin: 0 auto;
height: 4px;
display: inline-block;
margin:0px;
padding: 0px;

}
.mini-date-holder{
margin: 0px;
    line-height: 1em;
padding: 0px;
}

.mini_date{
     line-height: 0; 
}
<div class="mini_date">
<div class="mini-date-holder">10</div>
<div class="mini-event-holder">
<div class="mini-event"></div>
<div class="mini-event"></div>
<div class="mini-event"></div>
</div>
          </div>

Answer №2

In my opinion, the key lies in adjusting the line-height property. You might want to consider setting the line height of both divs to 0.

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

Validating radio buttons in Ionic framework

I am currently working on implementing a form in my application using Ionic and AngularJS. I have added validation to all the fields, but I am facing an issue with the radio button validation. The error message is being displayed correctly when no radio bu ...

Is it possible to alter the color of the text "midway" within a character on a website?

In some desktop applications, I've noticed a cool feature where the color of text changes as the background evolves. This allows for multiple colors on a single character, which is especially useful when displaying progress bars with percentages insid ...

Troubleshooting the issue: AngularJS not functioning properly with radio button selection to show specific div containing input field

Looking for some help with radio buttons: I need the selection of radio buttons to display their respective input boxes. I have included a snippet of my HTML and controller code below. In my controller, I am using ng-change to call a function that uses jQu ...

Is there a way to include a button at the top of the Notiflix.Loading() overlay for closing or stopping it?

I've integrated the "notiflix" library into my project, and I'm currently using notiflix.loading.pulse() for a lengthy process. While this works perfectly fine, I would like to add a button (for closing/stopping the process) on top of the loading ...

Is there a way I can add opacity to a div without impacting the other elements contained in it?

When I set the opacity of a div, it seems to affect all the other elements inside that div by making them transparent too. However, I am looking for a solution where the child elements do not inherit the opacity of their parent. Any assistance on this is ...

The cache feature seems to be malfunctioning, resulting in images having to be reloaded every time

I am working on a simple webpage at . The issue I'm encountering seems to be specific to Google Chrome - every time I reload the page, the images are reloaded as if there is no cache. I noticed that when checking the example on stackoverflow.com, the ...

The outline color cannot be removed from vue-carousel

I recently downloaded the Vue Carousel library and here is the version I am using: "vue": "^2.6.11", "vue-carousel": "^0.18.0", When I click on the pagination, a focus effect is added to the element with an outlin ...

What are the essential Bootstrap CSS and JavaScript files that need to be connected to our HTML document?

I recently downloaded the most recent version of Bootstrap, which is version 4. Upon extraction, I noticed that it includes two folders: one for CSS and the other for JS. The CSS folder consists of approximately 12 CSS files, while the JS folder contains ...

Issue with margin:auto in Internet Explorer 5

I have been experimenting with IE11's developer tools and discovered that when changing the browser mode, everything appears as expected in Edge, 10, 9, 8, and 7. However, in IE5, the div is forced to align to the left instead of the middle. Could so ...

Dynamic updating of scores using Ajax from user input

My goal is to design a form that includes three "Likert Scale" input fields. Each of these three inputs will have a total of 10 points that can be distributed among them. The submit button should become enabled when the score reaches 0, allowing users to s ...

Is your webpage slow to respond after a page-refresh? (Delayed HTML rendering causing lag)

Whenever I adjust the screen size to that of a phone or any device smaller than 768px, the search bar doesn't display in its proper position until the page is refreshed. It should be correctly placed right from the start. Furthermore, when I resize th ...

Exploring for worth using BeautifulSoup

Can anyone help me extract the name of a person (Alex Key) from the following HTML markup: <div class="link_container"> <a class="follow_card" data-uuid="e47443373cfa93d5341ab809f0700b82" data-type="person" data-name="Alex Key" data-permalink="/ ...

Utilizing image backgrounds for hyperlinks in the Android browser

Encountering a minor issue with some <a> tags that have images as background, and the text inside the tags is indented using CSS. However, on the Android browser, part of the string used in HTML appears to cover the background image within the area o ...

Alignment of Card Element at Bottom in Bootstrap 5

Hey there! I'm new to Bootstrap and I'm facing an issue where I want to position a button element at the bottom of a card, even when the body text is minimal. However, no matter what I try, the button does not end up in the bottom right corner as ...

Text transitions in a gentle fade effect, appearing and disappearing with each change

I want to create a smooth fade in and out effect for the text within a div when it changes or hides. After researching on Google and Stack Overflow, I found that most solutions involve adding a 'hide' CSS class and toggling it with a custom func ...

Adding a stylish underline to text using HTML and CSS

Looking for some assistance with my Html and CSS website project. I am currently facing a challenge trying to place a border below the text as shown in the provided image. Below is the snippet of my Html code: <div class="Sectionheading"> ...

Button within the Magnific Popup (do not use to close)

I am currently developing a website with a gallery page that utilizes the Magnific Popup plugin. My client has provided lengthy 'captions' for each image, almost like short stories. To display these captions effectively, I have utilized the titl ...

Eliminate repeated entries in a drop-down menu and display them with commas in between

I am working with a list that contains various language combinations: German to English German to Spanish German to Chinese German to French English to Spanish English to French English to Greek English to Portuguese Does anyone have suggestions on how ...

What could be causing certain link titles to appear outside of my <a> tags?

Check out this jsbin link to see the issue I am facing. I noticed that some of my link titles are appearing outside the anchor tags. Initially, I thought it was because some titles were enclosed in double quotes. I tried creating a function to fix this, b ...

Divide HTML elements every two words

Can you use CSS to break up HTML content after every 2 words, ensuring it works for any word combination? Example: // Original HTML content The cat is sleeping // Desired result: The cat is sleeping ...