Having difficulty removing whitespace from JavaScript code

Struggling to align a div using Javascript on my professor's website to match the spacing of the rest of the site. Despite attempts at adjusting margins and following suggestions from other Stackoverflow.com threads (e.g. CSS: Center block but left align contents), nothing seems to be working.

The goal is to position the links higher up on the page, similar to the layout of other pages.

This is what I currently have:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="ecl.css" />
<title>Sarah Lawrence College: Research</title>
<script type="text/javascript">
function hideshow(which){
if (!document.getElementById)
return
if (which.style.display=="block")
which.style.display="none"
else
which.style.display="block"
}
</script>
</head>

<body>
<div id="header"><img src="images/celab-header-reduced.jpg" /></div>
<div id="navigation">
  <ul>
    <li><a href="index.html">About</a></li>
    <li><a href="research.html">Research</a></li>
    <li><a href="teaching.html">Teaching</a></li>
    <li><a href="publications.html">Publications</a></li>
    <li><a href="members.html">Lab Members</a></li>
    <li><a href="contact.html">Contact</a></li>
  </ul>
</div>
  <div id="researchcontent">
    <ul>
      <li>
        <div class="showhide"><a href="javascript:hideshow(document.getElementById('ptsd'))">
          <h1>Posttraumatic Stress Disorder (PTSD)</h1>
          </a></div>
        <div id="ptsd">We are currently conducting a series of studies using cognitive and brain imaging techniques to explore the impact of combat trauma on memory and emotion. These studies examine how one’s self-perception affects various processes associated with recovering from combat trauma.</div>
      </li>
      ...
    </ul>
  </div>
</body>
</html>

CSS used:

/* Structure */

div#content {
    width:600px;
    float:center;
    margin:auto;
}


div#navigation {
    float:left;
    margin:auto auto;
}

...

Answer №1

To identify and eliminate unwanted space, simply add the following CSS code to the end of your current stylesheet. These custom styles will highlight issues for easy detection.

* {
  background: #000 !important;
  color: #0f0 !important;
  outline: solid #f00 1px !important;
 }

After applying the CSS, utilize your browser's developer tools to fine-tune the styles as needed.

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

Issue encountered while fetching data from SQL database in a Node.js application

After successfully connecting the database to my node js project, I encountered an issue when attempting to retrieve data using the get operation. Despite the connection working fine, I was unable to resolve the error that occurred. Establishing the SQL c ...

Ensure that the file exists before including it in the $routeProvider template for ng-include

Using Angular routes, I have set up a system where the slug from the URL determines which file to load. The code looks like this: $routeProvider.when("/project/:slug", { controller: "ProjectController", template: function($routeParams){ return & ...

Enable vertical scrolling within the table body to display entire rows

Encountering an issue with using overflow-y inside tbody. Attempting to set the maximum height of the tbody results in it shrinking into a single column, as shown in image 1. Seeking assistance in resolving this problem. Thank you. Below is the HTML code: ...

Verification of radio selections

I have successfully implemented validation for the radio button. Now, I would like to add an alert box that asks "Are you sure you want to pick 'x'?" before proceeding with the code. If the user clicks cancel, they should return to the webpage. B ...

Incorporate action icons (such as edit and delete) into a table in React.js using material-ui

Within my existing table, I utilized a library known as react-bootstrap-table-next This library effectively displays data in a table format with values originating from a JSON response Now, my goal is to integrate an Action column that includes options f ...

Limit the number input to only allow values between 0 and 100

I am utilizing the Number input component from MUI, which includes Increment and Decrement buttons for adjusting numbers. Is there a method to limit the input to only accept values ranging from 0 to 100 ? Additionally, how can I decrease the width of the ...

Erasing a Cookie

I'm currently developing a feature on my website that involves adding [ITEM] and using cookies. The Add [ITEM] functionality is already working, but now I need to implement a Remove [ITEM] feature. Below is the code snippet I have so far: $(window).l ...

Choosing HTML components using Selenium in the Whatsapp application

Apologies in advance for any language errors. I am currently working on a script using selenium and python to identify all messages with photos in a group. The structure of all message boxes is the same. Repository: # feel free to check out my code if you ...

What is the best way to retrieve the slot object property in order to send it to a component for a specific data table row in Vuet

I have defined a vue data property as shown below: data() { orders: [], order: { order_id: null length: null, width: null, } } Additionally, I have implemented a vuetify data table structured like this: <v-data-table v-if=& ...

Having difficulty reliably loading a sizable JSON response with jquery.ajax

Recently, I encountered an issue with one of my scripts that retrieves a json response from the server. The script uses jquery.ajax() to make an ajax call. Here is the code snippet: var request = $.ajax({ url: "script.jsp", type: "POST", dataType: " ...

Storing multiple arrays with Mongoose rather than just one array

I have encountered an issue while trying to save an array on MongoDB using mongoose. Below is my model setup: let itemFields = { "name": { "type": "String", "required": true, "unique": true } }; let modelFields = { "name": { "type": "String", "requir ...

adjust highcharts chart size to fit screen width

Has anyone experienced issues with setting an explicit width of 400px on a chart? I am facing difficulties as the chart gets cut off instead of scaling down to that size. My main concern is having it resized properly for an iPhone mobile site. Can anyone ...

Which particular files should be included such as CSS and JavaScript?

After downloading bootstrap4, I'm unsure which css, js, or other files are necessary to include in order to make my form Bootstrap ready. My current task involves creating a form in CakePHP 3. Click here for more information on how to create a form ...

Ensure that your JQuery code only runs after Angular has completed its rendering

As a newcomer to Angular JS, I may have a question that seems silly. Despite seeing it discussed in several SO questions, I still couldn't figure it out. My goal seems simple, yet I've had a tough time achieving it. I'm attempting to execut ...

Having difficulty rendering the Three.js OBJ model

Greetings everyone, I recently attempted to load a 3D OBJ file using a Loader in my project. The console indicates that the 3D model and texture have been successfully loaded, but unfortunately, nothing appears on the screen. I extracted the 3D model and ...

Issues with ngresource failing to properly filter data when calling an oData based Rest Controller

My web API controller is built with MongoDb as the backend. public class NodesRestController : ApiController { private INodeService _nodeService; public NodesRestController(INodeService nodeService) { _nodeService = nodeService; ...

All things considered, let's delve into the topic

There is an object that looks like this: "oldObject": [ { "id": 1, "path": "http://imageurl", }, { "id": 2, "path": "http://imageurl" }] I am looking to transform this object ...

What happens to top level data in Handlebars templates when using #each loop?

Why does the top-level object data disappear when using Handlebars' #each? For example: Using jQuery and Handlebars, $(this).html(Handlebars.getTemplate('summary')({ base_url: "http://www.mywebsite.com/", // this is what I mean by top ...

Retrieve a selection of data from the data.json file and mix it up

My webpage has a json data sheet containing multiple objects that I am currently showcasing. { "objects": [ ... ] } In terms of templating: $(function () { $.getJSON('data.json', function(data) { var template = $('#objectstpl') ...

Targeting a particular user category using MySQL and PHP

Currently, I am working with 3 files for connection.php which include work.php and login.php. These filesare vital in helping me identify the type of users or administrators in the database. My coding/dev process requires the use of MySQL, hence why I uti ...