Ways to eliminate excess spacing in the header image

html, body {
  margin:0; 
  padding:0;
}

.nav {
  margin:0px;
}

.navbar{
  margin-bottom:0px;
}

.header{
  margin:0px;
  padding:0px;
  display:block;
  vertical-align:middle;
  width:100%;
}
<! doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
    <!-- Custom CSS -->
    <link href="css.css" rel="stylesheet" type='text/css'>
    <!-- Optional theme -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css" integrity="sha384-aUGj/X2zp5rLCbBxumKTCw2Z50WgIr1vs/PFN4praOTvYXWlVyh2UtNUU0KAUhAX" crossorigin="anonymous">
    <!--font family-->
    <link href='https://fonts.googleapis.com/css?family=Oswald:700" rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Fjalla+One" rel='stylesheet' type='text/css'>
  </head>
  <body >
    <!--Navigation-->
    <nav class="navbar navbar-inverse navbar-static-top">
      <div class="conatiner-fluid">
        <!--page scroll button for -->
        <div class="navbar-header page-scroll">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target= "#myNavbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand page-scroll" href="#page-scroll">Website</a>
        </div><!--page scroll button-->
        <div>
          <div class="collapse navbar-collapse" id="#myNavbar">
            <ul class="nav  navbar-nav navbar-right" id="#myNavbar">
              <li class="hidden"><a href="#page-top"></a></li>
              <li class="page-scroll"><a href="#">Home</a></li>
              <li class="page-scroll"><a href="#about">About</a></li> 
              <li class="page-scroll"><a href="#services">Services</a></li>
              <li class="page-scroll"><a href="#contact">Contact</a></li>
            </ul>
          </div> <!--ul-li-->
        </div> <!--navbar collapse--> 
      </div> <!--container-fluid--> 
    </nav>
    <!--Navigation-->
    <!--Header-->
    <header > 
      <div class="container" >
        <div class="row">
          <img src="%previous_url%" class="img-responsive" >
        </div>
      </div>
    </header>
    <!--Header-->
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <!-- Latest compiled and minified JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script>
  </body>
</html>

I'm currently working on my first website but having trouble with persistent white space surrounding the header image.

Despite trying different strategies like adjusting margins and utilizing padding:0;display: block along with width:100%, I am still unable to remove the unwanted whitespace.

If someone could review the code and provide insights on what might be causing this issue, it would be greatly appreciated.

https://i.sstatic.net/ioDDb.jpg

Answer №1

Modify the

<div class="container"> to <div class="container-fluid"> 

and set your image's

width to 100%.

For example:

<style>
  .width_full {
    width: 100%;
  }
</style>

<div class="container-fluid">
  <div class="row">
    <img src="work.jpg" class="img-responsive width_full">
  </div>
</div>

https://i.sstatic.net/zeRRa.jpg

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

Update the FontSize in the HTML dropdown menu using JavaScript

I am having trouble filling my Selection using a script. For example, when I try to populate my FontSizeMenu, I use the following code snippet: function FillFontSizeMenu() { FillSelection(GetPossibleFontSizes(), "fontSizeMenu"); } function GetPossib ...

Disabling the scrollbar within angular elements

Trying to remove the two scrollbars from this code, but so far unsuccessful. Attempted using overflow:hidden without success filet.component.html <mat-drawer-container class="example-container" autosize> <button type="button&qu ...

The menu-item is unable to be centered in its location

I've exhausted all my efforts, but still can't seem to center this menu-item. Here is the code I've been working with: <div class="nav nav-tabs mb-2" id="nav-tab" role="tablist"> <a class="nav-item nav-link active" id="na ...

A guide on verifying the username, password, and chosen role from a database through the use of javascript/ajax or alternative validation methods

If the user's name, password, or role is incorrect, I want to display an error message using validations like AJAX/JavaScript. index.php <html> <head> </head> <body> <style> body { wi ...

Passing arguments inside the source attribute of an image or link tag in Node.js and

As a beginner in NodeJS, I am facing an issue with passing arguments inside links and image sources. In my template.html file, I have included various scripts and elements to create a search form. The issue arises when I try to incorporate values from the ...

Error: the function was not defined and has not been caught

In an effort to develop a quiz application, I am working on a feature that will increment a counter when the correct answer is selected. While I have identified the correct answer, I am struggling with implementing a method called correctTest to achieve th ...

What is the process of attaching a CSS class to jQuery variables?

Welcome everyone! I am relatively new to CSS and jQuery. In my project, I'm using different CSS classes based on certain conditions within a loop. if(get_node_details[i]['node_status'] == "ONLINE") { var panel_color = ".panel panel-prim ...

Interactive sidebar component with navigation and animated section markers

For weeks, I've been attempting to create a navigation sidebar similar to the ones shown in these images: Even though getbootstrap.com/components offers appealing navigation sidebars, I have not found a built-in component in their library. This has m ...

Seeking out all (including potentially relative) URLs on a webpage: Possible strategies to consider

For a coding challenge, I am working on a small python tool to download an entire website locally. In order to view the website offline, I need to convert all URLs to relative URLs. This is necessary to ensure that resource files (such as .js and .css) are ...

Ways to incorporate horizontal scrolling into an HTML table

I am looking to incorporate a horizontal scroll feature into my HTML table. The table has a width of 100% and the first cell has a fixed width of 50px. There can be hundreds of columns in this table, so I want the first column with the fixed width to alw ...

WordPress Migration Causing Issues with Custom Font Display

I recently moved my website from to using the Duplicator plugin, but I'm facing an issue with the custom font 'Kanit' not displaying correctly. I have double-checked on the backend and confirmed that Kanit font is properly set up. Below i ...

Safari 5.1.7 causing unusual behavior on the website

Despite running smoothly in most browsers, this website goes haywire and crashes on Safari when viewed on a Mac. I've attempted troubleshooting by removing the Google map, CSS transforms, and the Stellar jQuery plugin, but the issue persists. Does any ...

What technologies are utilized to create this price chart in the JavaScript visualization?

Does anyone know how this historical data price graph is created? I've heard of JS libraries like that can generate visualizations, but I'm not very familiar with JS. Any tips on how to create a similar visualization would be greatly appreciate ...

Utilizing Selenium to automate a VBA loop for extracting HTML data directly into an Excel spreadsheet

I recently received help from the Stackoverflow community to scrape data from a webpage. It's an amazing group of people. They provided me with a function that imports data into Excel from a cell containing a URL. However, I'm facing issues becau ...

"Utilize PHP to link to the same page, pass data through $_POST method, and

I have a database table containing (NumSection (id) and NomSection) In my webpage, I want to display all the data from 'NomSection' as a link. When clicked, I want to open the current page with $_POST['nomSection'] and show the data fo ...

How can we ensure an image fills up the entire screen while still being contained within a Bootstrap 4 container?

I have a unique setup on my Wordpress page template. The content from the parent template is displayed first, followed by the content of child templates, including featured images. I want the content to appear in the container class, while the featured ima ...

What is the best way to limit the length of a field in a datatable and provide an option to display the full data with "<more options>" at the end?

I am utilizing a datatable to showcase a report within my application. Some of the columns contain extensive data that I would like to truncate for viewing purposes, with the option to click and expand to see the entire content as needed. I attempted usin ...

Tips for rotating and positioning an element in the top left or top right corner of a page

I recently tried rotating a div with text and wanted to position it at the top left corner. I was able to successfully align it at the top, but I'm having trouble getting it to align with the left edge. Any tips on how to achieve this? .credit { ...

Combining left-aligned and centered elements within a grid using flexbox

Looking to create a fluid responsive grid layout using flexbox, without the need for media queries. The number of elements in the grid can vary and each item should have a fixed, equal width with left alignment. The entire group should have equal left and ...

Leveraging Selenium to extract text from a dynamically populated DIV using JavaScript

I am currently utilizing Selenium to automatically retrieve all comments from a New York Times article. Once the comments are loaded, my goal is to extract them and save the information for future use. However, upon inspecting the source code of the articl ...