Eliminating an unwelcome gap between two div elements

I couldn't find anything on Google, so I searched this site and came across a similar topic Unwanted space between divs. I tried applying

margin:0px;

in several places, but there is still space between the two divs.

Here's my HTML:

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>title/title>
<link rel="stylesheet" type="text/css" href="e.css">
</head>


<body>

<div id="page">

    <div id="content">
        <div id="up">
            <div id="tab">
                  <ul id="tabmenu">
                <li id="anm" class="tbs blue"><a href="#"><span>Anm</span></a></li>
                <li id="kom" class="tbs blue"><a href="#"><span>Kom</span></a></li>

                <li id="omt" class="tbs blue"><a href="#"><span>Omt</span></a></li>
                <li id="sts" class="tbs blue"><a href="#"><span>Sts</span></a></li>
              </ul>
        </div>

        <div id="usrp">
            <div id="usr">
            </div>
        </div>
    </div>

    </div>

    <div id="bottom">

    </div>
</div>
</body>
</html>

And here's my CSS:

html {
    height: 98%;
}

body {
    height:99%;
}

#page {
    height:99%;
}

#content {
    /*border:2px solid blue;*/

}

#bottom {
    border:2px solid green;
    height:15%;
    vertical-align: bottom;
}

#up {
      /*border:dotted green 2px;*/
      width:59%;
}

.usrcom {
    border-bottom: 2px dotted blue;
    margin-left:15px;
    margin-right:15px;
}

#usrp {
    width:100%;
    clear:both;
    border-right: 2px solid blue;
    border-left: 2px solid blue;

    border-bottom:2px solid blue;
    border:dotted yellow 2px;


}

/***Tabs menu*****/
#tabmenu {
  float:left;
  width:685px;
  /*background:#BBD9EE;*/
  /*background:#FF6633;*/
  font-size:93%;
  line-height:normal;
  margin-top: 0px;
  margin-left: 0px;

  /*border:dotted red 2px;*/
  border-bottom:2px solid blue;
  /*border:dotted red 2px;*/


}

#tabmenu ul {
  /*background:#BBD9EE;*/
  padding:0px 0px 0 0px;
  margin:0px;
  list-style:none;
  border:dotted green 2px;
}

#tabmenu li {
  display:inline;
  padding:0;
  margin:0px;
}

#tabmenu a {
  float:left;
  /*background:url("img/tableft2.png") no-repeat left top;*/
  margin:0;
  padding:0 0 0 4px;
  text-decoration:none;
}

#tabmenu a:hover span {
background-color:#3399FF;
margin:0px;
border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

#tabmenu a span {
  float:left;
  display:block;
  /*background:url("img/tabright2.png") no-repeat right top;*/
  padding:5px 15px 4px 5.5px;
  margin:0px;
  color:#FFFFFF;
  background-color:#0000FF;

  border-top-left-radius: 15px;
  border-top-right-radius: 15px;
}

I can't figure out why the space is occurring and how to remove it.

Edit:

Oops, forgot to mention which divs,

The space is between 'Tabmenu' and 'usrp'

Edit:

Tried adding in my css

#tab {
    margin: 0px;
    padding:0px;

}

It's really between 'tab' and 'usrp', but that didn't help at all.

Answer №1

To style the tab menu using CSS:

#tabmenu {
  margin:0; 
}

The above code snippet should work perfectly

Answer №2

Discover the power of using an inspector tool to "inspect this element". By hovering over elements on your webpage, you can easily view their margins/paddings and identify the CSS responsible for them. With the ability to edit CSS in real-time, you can test fixes before implementing them. Personally, I recommend using the Firebug add-on for Firefox, but modern browsers like Chrome, Safari, and Internet Explorer also offer built-in inspection tools.

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

Display a loading GIF for every HTTP request made in Angular 4

I am a beginner with Angular and I am looking for a way to display a spinner every time an HTTP request is made. My application consists of multiple components: <component-one></component-one> <component-two></component-two> <c ...

Create a hover effect on HTML map area using CSS

Is it possible to change the background color of an image map area on hover and click without using any third-party plugins? I attempted the following code: $(document).on('click', '.states', function(){ $(this).css("backgro ...

Extracting table data using regular expressions in Import.io is a powerful method to retrieve specific values

Need some assistance. I am currently utilizing import.io and aiming to extract table data using regex. My goal is to retrieve values from specific columns, below is the code snippet: <table> <tr> <td class='label&apos ...

Altering the "src" property of the <script> tag

Can the "src" attribute of a current <script> element be altered using Jquery.attr()? I believed it would be an easy method to enable JSONP functionality, however, I am encountering difficulties in making it operate effectively. ...

Modify the parent div's style if there are more than two children present (CSS exclusive)

Is there a way to use the same class, like .outer, for both divs but with different styling for the parent element when there are more than two children? Kindly refer to the example provided below: .outer1{ border: solid 6px #f00; } .outer2{ b ...

What is the best way to design a form with two dropdown menus, where the options in the second dropdown menu are determined by the selection made in the first dropdown menu

Is it possible to create two select menus using one dictionary in Django, where the values in the second menu are dependent on the key selected in the first menu? In my Django views.py file, I've constructed a dictionary with Projects as keys and cor ...

Connecting JavaScript and jQuery scripts

Help needed! I am a beginner in the world of jQuery and JS. Unfortunately, my JS/jQuery code is not running and I can't figure out why. Can someone please take a look at my HTML and guide me on what might be causing the issue? Do I need to add some ad ...

Implementing a Dialog Box for Confirmation

I want to include a "confirmation box" that will display the message "Are you sure you want to update/delete question?" when I press the "update" and/or "delete" buttons. I attempted to add onclick="return confirm('Are you sure you want to logout?& ...

div maintain aspect ratio while scaling

My current layout is structured like this: HTML <div id="container"> <div id="zoomBox"> <div class="box"></div> <div class="box"></div> <div class= ...

The hamburger icon seems to be frozen and unresponsive

I'm struggling to get my hamburger icon to reveal the navigation bar when clicked. The icon itself functions properly and adapts to different screen sizes, but the overlay remains stationary. Check out my code on JSFiddle! <html> <head> ...

What is the best way to target an HTML attribute using jQuery?

I have customized a Textbox by adding a special attribute: <asp.TextBox MyCustomAttribute="SomeValue"><asp.TextBox> Now, I want to retrieve this value from within an AJAX success function. Please note that I have excluded irrelevant attribut ...

Is there a common method for generating complex identifiers to be used as the HTML element's id, class, or name attributes

Is there a recommended method for "encoding" complex identifiers such as {Source:"ARCH.1", Code: "456-789.456 A+", SubNumber:##2} to be used in HTML elements' id, class, and name attributes? I could come up with something myself, but perhaps there is ...

The ::before pseudo element is malfunctioning when used in the makeStyles function

I am currently utilizing the makeStyles function in React, but I seem to be facing an issue where the content within the ::before pseudo-element is not displaying. Strangely enough, when the content is an image it works fine, but text does not render. Jus ...

Offering various language options on a website determined by the URL

I've been contemplating how to add multi-language support to my personal website, which I developed using ExpressJS and NodeJS with EJS as the template engine. Currently, the website is only available in English, but I want to add a German version as ...

Ways to retrieve the path of a button found within table cells

https://i.stack.imgur.com/pUYHZ.jpgI'm currently working on a table where I've created a button that's being used in various rows and tables based on certain conditions. There's a specific scenario where I need to display the button for ...

Display a fresh <p> tag when the condition in the if-statement is met

If you are looking for a questionnaire, check out this one. Now, I am interested in creating if-statements using HTML/CSS/jQuery to achieve the following scenario: Initially, only Question 1 will be visible. When the input matches a certain value like X, ...

Steps to establish a maximum font size for my buttons

I've been working on creating buttons to decrease and increase the font size of my text. The functionality is there, but I want to establish a limit on how small or large the font can go. Here's what my current code looks like: <md-button ng ...

Files on video input are now accepting audio attribute

Currently, I am adding a file upload feature to my application. I have created input fields for various types of media. <label>Images<input type="file" accept="image/*"/></label> <label>Videos<input type="file" accept="video/*"/ ...

Ensures that two divs have the same dimensions

Currently, I have a line of sections set up like this: I am attempting to ensure that the second div matches the height of the first one, despite the fact that their heights are determined by the size of the pictures which may vary. Do you have any sugges ...

Error code received from OpenStack Identity API GET response

I am an intern student and I have a query. Currently, I am working on bug fixing for an Openstack cloud, JavaScript, and Node.js web application. My task involves resolving toastr.error messages and translating them into different languages. How do I ret ...