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

Is it possible to use AJAX to change the class name of a Font Awesome icon?

I am considering updating the icon after deleting a row. Should I initially include the font awesome icon once in the blade, then remove the class name and add it back with ajax? blade: <div id="status-{{ $country->id }}"> <div id ...

How can I ensure that the scripts returned in HTML via AJAX are executed when using $.load()?

I have been trying to make an AJAX call and receive a partialView which contains some script that needs to be executed. I did some research and learned about the "eval" method, but then discovered that the $.load() method should handle this for me. Howeve ...

Setting a custom background image in a Bootstrap modal

When users visit my website, I want to enhance their experience by using a background image in my bootstrap modal. Despite several attempts, I have been unable to successfully set a background image in the modal. Can anyone provide guidance on this matter? ...

Pressing JavaScript buttons to trigger another button

I am looking to develop a script that generates a button which then creates another button. The subsequent button will be assigned an id attribute by incrementing from 1 to infinity. This feature should apply to all buttons (original button and the newly ...

I desire a smooth fade-in transition for the background image when the addClass function is

If the background color is set to header-fixed-position, the color will fade in. However, if the background is an image, the image will not fade in. Apologies for my lack of proficiency in English. Please refer to the sample code below. Try removing the c ...

Is it possible to utilize a .css file as the origin with @font-face?

Received a shortened path to a Gotham font... https://cloud.typography.com/[path shortened]/css/fonts.css Attempting to use it in a @font-face definition but facing issues with the src format: @font-face { font-family: 'Gotham'; src: url(" ...

What should I do when dealing with multiple submit buttons in NextJS?

How can I differentiate between two submit buttons in a form component created in Next.js? I'm struggling to determine which button was pressed and need help resolving this issue. import React from "react"; const LoginPage = () => { as ...

Obtain several dropdown menus without their items displaying beneath the correct element

I'm currently in the process of setting up multiple drop down menus within a navigation element. The issue I'm facing is that when a user hovers over the menu items, the displayed elements appear below the first item instead of the selected one. ...

Tips for Resizing and Reviving Divs with jQuery

I have recently ventured into the world of web development to assist a family member with their website. My knowledge and experience are limited, but I am facing an interesting challenge. I am trying to manipulate certain divs as users scroll down the page ...

AngularJS: Issue with scope not updating across several views

Having one controller and two views presents a challenge. ClustersController angular.module('app.controllers').controller('ClustersController', [ '$scope', 'ClustersService', function($scope, ClustersService) { ...

Issue with preventDefault not functioning correctly within a Bootstrap popover when trying to submit a

I am facing an issue with a bootstrap popover element containing a form. Even though I use preventDefault() when the form is submitted, it does not actually prevent the submit action. Interestingly, when I replace the popover with a modal, the functional ...

Display or conceal toggle in ruby utilizing jQuery

I'm facing an issue with the functionality of a button that is meant to hide and show a form using jQuery. Initially, I added a path to signup in the button so that it would display and function properly. Now, when I click the button, the form shows u ...

Retrieve the website address from a string of HTML code

I'm struggling to extract the URL from a given String that contains an HTTP response with an HREF tag. I've managed to identify the start of the links, but I need to stop the string as soon as the HREF tag ends. How can I accomplish this? public ...

Is it feasible to generate a realistic arrow using CSS and then rotate it?

Can a fully functional arrow be created using CSS alone? Here is the method I used to create just the arrowhead: http://jsfiddle.net/2fsoz6ye/ #demo:after { content: ' '; height: 0; position: absolute; width: 0; border: 10p ...

Ensure Focus Retention Upon Clicking Inside Iframe with li a:focus

How can I prevent my ul.SideNav_Main li a:focus class from losing focus when I click on the iframe or elsewhere on the page? Shouldn't it maintain focus until I click on another URL in the list? Is it possible to solve this issue with just CSS, or wo ...

Implementing both inset and external box shadows on the same div element

Is it possible to apply both inner and outer box shadow to the same div element? I've attempted it but it doesn't seem to be working as expected. http://jsfiddle.net/CWuw8/ div{ top: 100px; position: absolute; left: 100px; hei ...

Steps to create a toggle feature for the FAQ accordion

I am currently working on creating an interactive FAQ accordion with specific features in mind: 1- Only one question and answer visible at a time (I have achieved this) 2- When toggling the open question, it should close automatically (having trouble with ...

Mastering the integration of this asmx webservice with jQuery/ajax

Hello, I need some assistance with a webservice that I have. The webservice URL is My goal is to display a list of products from this service (where ObtenerProductosPorId translates to GetProductsById) on an HTML page. I have been researching how to achi ...

"Explore the dropdown options on the Twitter Bootstrap menu by hovering your cursor

Is there a way to modify the code so that when hovering over a dropdown menu created with Twitter Bootstrap 3, the menu expands and users are able to click on the expanded links? The HTML code I came up with is as follows: <nav> ...

How to dynamically set a background image using Ionic's ngStyle

I've been trying to set a background image on my card using ngStyle Take a look at my code below: <ion-slides slidesPerView="1" centeredSlides (ionSlideWillChange)= "slideChange($event)" [ngStyle]= "{'background-image': 'ur ...