Eliminate the whitespace separating two div elements

How do I eliminate the empty space between the header and wrapper div elements?

Check out this DEMO fiddle. Below is the HTML code:

 <div id="container">
    <div id="header">
        <div id="logo">
        </div>
        <div id="login">
            <h3>
                CLIENT LOGIN</h3>
            Username
            <input type='text' name='username' id='username'>
            <input type='button' name='login' value='Login' id='btnLogin'>
            <br />
            Password:
            <input type='password' name='password' id='password'>
            <input type='button' name='register' value='Register' id='btnRegister'>
        </div>
        <div id="navigation">
            <ul>
                <li class="active"><a href="#">Home</a></li>
                <li><a href="#">Profile</a></li>
                <li><a href="#">Contact</a></li>
                <li><a href="#">Group</a></li>
                <li><a href="#">Seminar</a></li>
            </ul>
        </div>
    </div>
    <div id="wrapper">
        <div id="contents">
            <div id="welcome">
                <h3>
                    Welcome to Somara</h3>
                <p>
                    It is a long established fact that a reader will be distracted by the readable content
                    of a page when looking at its layout.</p>
                <p>
                    There are many variations of passages of Lorem Ipsum available.</p>
            </div>
        </div>
    </div>
    <div id="footer">
    </div>
</div>

Here is the CSS code:

    body
{
    width:100%;
    margin:0px;
}

#header
{
    width: 100%;
    background-color: #2c2520;
    min-height: 200px;
}
#login
{
    float: right;
    color: white;
}
#logo
{
    background-image: url('../img/logo.png');
    min-height: 191px;
    min-width: 230px;
    float: left;
    background-repeat: no-repeat;
}
#navigation
{
    padding-top: 158px;
    margin-right: -200px;
    float: right;
}
#navigation li
{
    display: inline;
    min-width: 100px;
    padding: 5px 5px 5px 5px;
}

#navigation a
{
    text-decoration: none;
    font-family: Tahoma, calibri;
    font-size: 15px;
    color: #f8f8f8;
}
.active
{
    background-color: #afaba5;
    color: black;
}

.inactive
{
    color: white;
    background-color: #392f2b;
}

#contents
{
    width: 950px;
    margin: 0px;
    min-height: 700px;


}

#wrapper
{
    width: 100%;
    margin: 0 auto;
    background-color: #39302b;
}


#intro1
{
    min-width: 30%;
    max-width: 35%;
    min-height: 250px;
    float: left;
    padding: 10px;
    padding-right: 50px;
    padding-left: 50px;
    color: #cdcdcd;
}

#welcome
{

}

#welcome h3, p
{
    font-family: Myriad Pro;
    color: white;
    text-align: center;
    font-weight: normal;
}

#welcome p
{
    color: #cdcdcd;
    font-size: 20px;
}

Answer №1


Eliminate the margin attribute from the CSS selector #welcome h3

#welcome h3, p {
font-family: Myriad Pro;
color: white;
text-align: center;
font-weight: normal;
margin: 0;
}

link

Answer №2

It is recommended to use the following CSS style:

#welcome h3, p {
 font-family: Myriad Pro;
 color: white;
 text-align: center;
 font-weight: normal;
 margin-top: 0px;
}

For more information, please visit the following link: http://jsfiddle.net/mynameisvikram/ygvwL724/2/

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

The absence of $_POST results in the values being stored in $GLOBAL instead

Ever since I reinstalled my OS, I've been encountering a peculiar $_POST issue. When I returned to one of my side projects, I realized that all my POST requests were not functioning properly, despite having worked before. I've observed that all ...

Utilizing Javascript for altering HTML elements

It seems this issue is quite puzzling and I believe another perspective could be beneficial in identifying the problem. Despite my efforts, I am unable to understand why the "Energy Calculator" does not return a value when submitted, whereas the "Battery C ...

What is causing the CORS error with JQUERY and JQM?

My HTML5 page is set up without any jQuery and has no CORS error, as shown below: <!DOCTYPE html> <HTML> <button type="button" onClick="getBase64FromImageUrl()">Click Me!</button> <img id="preview1" crossorigin="anonymous" src=" ...

Remove the list by conducting a comparison analysis

<html> <head> <title> Manipulating List Items Using JavaScript </title> <script type="text/javascript"> function appendNewNode(){ if(!document.getElementById) return; var newlisttext = document.changeform.newlist.val ...

Using HTML to get the minimum date specified by a different date

Can someone assist me? I am trying to retrieve the minimum parameter for the second date field based on the value entered in the first date field: Check-In: <input type="date" name="checkin" min="<?php echo date('Y-m-d');?>" required& ...

``Please proceed with the form submission only if it has been verified and

Within my web application, there are several pages that handle submitted data from forms. I would like to prevent the following scenario: A user creates a form on the client side with identical fields to my original form and sends it to the URL responsibl ...

Navigate audio tracks with JavaScript

I'm currently facing an issue with using a button to switch between two audio tracks being played in the browser. The method I have implemented switches to the second track, but it doesn't change the audio that is played afterward - instead, it s ...

Text that appears automatically in an input field

I've searched high and low, but I just can't seem to find a solution that works for me. What I need is a way to automatically populate a HTML text field with default text when the page loads. This default text should ideally be a PHP variable and ...

Troubleshooting a Jquery example that fails to run on popular browsers like IE, Chrome, and Firefox

I've been struggling to get this particular example to function properly (using vs2010): <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD X ...

What are the best methods for detecting devices in order to create customized CSS styles for iPad and Galaxy Tab?

Ensuring my web application is compatible with various devices is crucial. While I have created a common CSS for all mobile and tablet devices, it seems to be causing some problems specifically on the iPad. After finding a fix tailored for the iPad, I now ...

Blend a background image using rgba without incorporating a gradient effect

Can you merge a background image with an rgba color without resorting to an rgba gradient? My current CSS3 style appears as follows: html { background: linear-gradient(rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.75)), url("../icons/sombrero.jpg")no-repe ...

Reduce the dimensions of a CSS attribute automatically

Displayed below is the image with a width of 192 and height of 109: <a href="https://www.blogger.com/u/1/blogger.g?blogID=4402911157743442948#"><img alt="" class="thumbnail" height="109" src="https://2.bp.blogspot.com/-E5ftfbCCgkw/XjnLpO347cI/AAA ...

Filter search results to display only posts

My website uses a custom Wordpress theme that has a search functionality. The issue I'm facing is that when I perform a search, it redirects me to the search.php page. However, instead of just displaying posts, it also shows pages and events from the ...

Utilizing Bootstrap and flexbox to create a card: repositioning the image to the left or right

Currently, I am attempting to construct a card layout using Bootstrap 4 with flexbox enabled. The image below depicts my current implementation, which is functioning as expected. https://i.sstatic.net/huXvo.jpg Here is the HTML structure: <section> ...

Reducing div size when clicked - Using JQuery version 1.9

I am looking to make a specific div shrink in size, while keeping all the data visible, each time a user clicks on a certain icon with the class legend-icon. For example, I want the div with the ID #Chart to shrink when clicked. This is the HTML code: &l ...

Issues involving JavaScript and jQuery

As a beginner in the world of JS and jQuery, I have encountered a problem that I am seeking assistance with. I am trying to use a script to insert content into a page, but I am facing a roadblock that I can't seem to overcome. Here's the specific ...

Setting the height of a child tag: A step-by-step guide

When trying to set the height of a child tag to 100%, I encountered an issue where the height would remain fixed after redirecting to another page, preventing the page from scrolling. Styling for Image 1 body{ background: url("Resources/Cash.jpeg&q ...

Display sub navigation when clicked in WordPress

I currently have the default wordpress menu setup to display sub navigation links on hover, but I am interested in changing it so that the sub navigation only appears when the user clicks on the parent link. You can view my menu here https://jsfiddle.net/f ...

The One-Click File Upload Dilemma

I have replaced the regular upload input + submit button with an icon. My goal is to automatically start the upload process when a file is chosen by the user. However, currently nothing happens after the file selection. <form action="upload.php" method ...

How to retrieve a variable from an object within an array using AngularJS code

I recently started learning TypeScript and AngularJS, and I've created a new class like the following: [*.ts] export class Test{ test: string; constructor(foo: string){ this.test = foo; } } Now, I want to create multiple in ...