The issue of CSS errors encountered when incorporating Bootstrap with the millimeter unit for padding

<!doctype html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title></title>
        
        
        <!-- bootstrap -->
        <link href="../css/lib/bootstrap.min.css" rel="stylesheet">
        
    </head>
    <body>
        <div style="padding:2mm;border-bottom:2px solid blue;">
        </div>
        
        
    </body>
</html>

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

I am stumped on the negative height of the div.

If you have any tips or pointers, please share!

Edit:

console.log($("#1").outerHeight());
console.log($("#2").outerHeight());
console.log($("#3").outerHeight());
<!doctype html>
<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title></title>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

  <!-- bootstrap -->
  <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c0a2afafb4b3b4b2a1b080f5eef0eef0eda2a5b4a1f2">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">


  <style type="text/css">

  </style>

</head>

<body>
  <div id="1">
    <div id="2">
      <hr>
    </div>
    <div id="3">
      <p>Text</p>
    </div>
  </div>


</body>

</html>

Answer №1

If You're Referring to Adjusting the Margin with a Negative Value, Here's How

<div style="padding:5mm;margin-top:-40px;border-bottom:2px solid blue;">
        </div>

In this scenario, a negative value for margin displaces the object in the opposite direction of its normal movement path. For instance, if margin-top is set as a negative value, the object moves upward instead of downward. Does this meet your requirements?

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

Is the form always being processed by onsubmit and confirm?

Apologies if this question has been asked before. I am currently working on a form where I ask the user to confirm an action, but it's not functioning as expected. The form proceeds regardless of whether the user clicks ok, cancel, or even closes the ...

How to dynamically change the border-top color of an <a> tag in a menu using a jQuery loop

I am interested in adding a colorful border-top to my menu using jQuery. I know this can be achieved with HTML by including style="border-top-color: red;", but I want to explore the jQuery method. Here is what I have attempted so far: var colors = [ ...

JavaScript function failing to validate password

While engaging in an online game where the objective is to uncover a password by inspecting the page source or element, I encountered a puzzling line: if(el.value == ""+CodeCode+""). My assumption is that el.value represents my guess, and it indicates that ...

What could be causing my website to function flawlessly in Firefox but not in Chrome or Internet Explorer?

Hey everyone, I'm feeling lost and have been comparing files using DiffNow. I don't have any code to offer because I'm unsure of where to even begin. The website is coded in php/html/mysql/jquery. Here are my main concerns: -Animations are ...

Instructions for positioning two 3D models within separate div elements using Three.js

The website contains various divs with classes such as "skin", "skin2", "skin3"... And each class corresponds to a different 3d model that needs to be placed. I am attempting to achieve this, but all the 3d models seem to be c ...

Arranging two tables, one slightly misplaced from the other

I have been searching through various websites, but I cannot find a solution to the specific issue I am facing. I am attempting to create a web page with a table aligned to the left side while keeping the rest centered. However, when I align items in the ...

Styling the elements that are next to each other using CSS

Hey there, what if I have HTML elements structured like this: <div> <div>Name</div> <div><input type="text" class="check"> <div>Age</div> <div><input type="number" class="check"></div> ...

drawImage - Maintain scale while resizing

I am currently working on resizing an image using drawImage while maintaining the scale. Here is what I have so far... window.onload = function() { var c = document.getElementById("myCanvas"); var ctx = c.getContext(" ...

Unable to interpret JSON data in D3visualization

While attempting to read a JSON file using the D3 library, I encountered an issue where I received an alert indicating null values. Here is the code snippet I am using: <!doctype html> <html lang="en"> <head> <meta charset="utf-8" ...

The central navigation system of the Owl Carousel

I am currently using the owl carousel plugin and I am struggling to figure out how to center align the navigation vertically while also using the autoHeight option. http://codepen.io/anon/pen/jJAHL I have attempted the following code snippet, but it seem ...

Attempting to choose everything with the exception of a singular element using the not() function in Jquery

Within the mosaic (div #mosaique) are various div elements. My goal is to make it so that when I click on a specific div, like #langages or #libraries, the other divs become opaque while the selected div undergoes a size change (which works correctly in t ...

Exploring the Potential of JSP in Form Submissions

Here's a OCWCD question that I encountered: <form action="sendOrder.jsp"> <input type="text" name="creditCard"> <input type="text" name="expirationDate"> <input type="submit"/> </form> The question based on the ...

Display a PDF on a website and ensure it is horizontally scrolled to the center

After embedding a PDF in a webpage, I noticed that the width of the window is smaller than the actual PDF, resulting in a horizontal scroll bar appearing. Surprisingly, the PDF itself has wide margins on both sides, making it challenging for users to view ...

Vuetify: how to disable the color transition for v-icon

My menu includes both icon and text items, with hover color styled using the following CSS: .v-list-item:hover { background: #0091DA; } .v-list-item:hover .v-list-item__title, .v-list-item:hover .v-icon { color: white; } The problem is that the ...

I am experiencing difficulties getting my custom CSS styles to appear on my webpage despite using Bootstrap

I recently entered the world of Bootstrap and decided to take an online class to learn more about it. During the course, I discovered that I could create custom CSS classes to enhance my webpage. So, I set up a folder named my project folder and added th ...

struggling to find the precise value in the array

my original result is displayed below: [status] => 1 [schedule_status] => 1 [cid] =>3 [cdate] => 16-10-18 01:10:52 [did] => 16 [jid] => 4 However, when I try to extract individual array values using the following code: $count = count($ ...

What is the best way to maintain the height of a table row while applying a CSS border to a cell within that row?

I am working on a jQuery script that selects a cell when clicked, and I want the row to maintain its height without changing. Even though I have set the height of the table row using CSS, whenever I change the border of a single cell, the entire row' ...

I'm stumped on how to resolve this CSS issue

As a beginner with the Angular 8 framework, I am exploring how to incorporate animations using angular animations. Below is an example of what my code currently looks like: The component's parent div is contained within <div class="col-md-5">& ...

Adding additional text within the paragraph will result in the images shifting backwards when utilizing flexbox

It seems like there might be something obvious that I'm missing here, but essentially my goal is to create a footer with 2 columns and 2 rows. In each column, there will be an icon (32x32) and 2 lines of text next to it. The issue I'm facing is ...

Selenium is notorious for chopping off screenshots

I've been attempting to capture screenshots of various elements from different sections of a lengthy webpage. The initial screenshot I take near the top displays properly without being cut off: https://i.sstatic.net/9MsC0.png However, when selenium ...