Reduce the indentation levels in a multi-tiered list

Is there a way to reduce the indentation in the second level of navigation on my website's navigation pane?

This snippet is crucial:

<style>
        div.sidebarOne {
        background-color: rgba(64, 224, 208, 0.50); 
        position: absolute;
        top: 0; 
        bottom: -3000px; 
        left: 1px;
        width: 270px;
        margin: 0 auto;
        clear: all;
        padding-left: 5px;
        }
        li{
        color: goldenrod;
        size: 20px;
        font-family: Bellota-Light;
        word-spacing: 5px;
        }
        li.sidebar{
        color: darkred;
        size: 20px;
        font-family: Bellota-Light;
        word-spacing: 5px;
        }
</style>
<aside>
 <div class="sidebarOne"> <!-- the sidebar on the right -->
<h1 format="title"> Contents </h1>
  <ul>
   <li class="sidebar">Inquiry and Analysis</li>
    <ul>
    <li class="sidebar"><a href="../Other Pages/Page_2_mindmap.html"> My MindMaps </a> </li>
    <li class="sidebar"><a href="../Other Pages/Page_3_narrowedmindmap.html"> My Research Topic </a> </li>
    <li class="sidebar"><a href="../Other Pages/Page_4_questions.html">Some Questions</a> </li>
    <li class="sidebar"><a href="../Other Pages/Page_5_pre-existingsites.html">Analysis of other websites</a> </li>
    <li class="sidebar"><a href="../index.html">Home</a></li>
    </ul>
   <li class="sidebar">Developing Ideas</li>
   <li class="sidebar">Creating a Solution</li>
   <li class="sidebar">Evaluating</li>
  </ul>
 </div>
</aside>

The sidebar is contained within <div class="sidebar.one">. I prefer not to change it to a nav tag.

Answer №1

To remove the default padding on lists, it is advisable to reset it using the following CSS:

ul {
  padding: 0;
}

You can then apply custom padding as needed. In this example, I have completely removed the default padding...

<style> div.sidebarOne {
  background-color: rgba(64, 224, 208, 0.50);
  position: absolute;
  top: 0;
  bottom: -3000px;
  left: 1px;
  width: 270px;
  margin: 0 auto;
  clear: all;
  padding-left: 5px;
}
ul {
  padding: 0;
}
li {
  color: goldenrod;
  size: 20px;
  font-family: Bellota-Light;
  word-spacing: 5px;
}
li.sidebar {
  color: darkred;
  size: 20px;
  font-family: Bellota-Light;
  word-spacing: 5px;
}
</style>
<aside>
  <div class="sidebarOne">
    <!-- the sidebar on the right -->
    <h1 format="title"> Contents </h1>
    <ul>
      <li class="sidebar">Inquiry and Analysis</li>
      <ul>
        <li class="sidebar"><a href="../Other Pages/Page_2_mindmap.html"> My MindMaps </a> 
        </li>
        <li class="sidebar"><a href="../Other Pages/Page_3_narrowedmindmap.html"> My Research Topic </a> 
        </li>
        <li class="sidebar"><a href="../Other Pages/Page_4_questions.html">Some Questions</a> 
        </li>
        <li class="sidebar"><a href="../Other Pages/Page_5_pre-existingsites.html">Analysis of other websites</a> 
        </li>
        <li class="sidebar"><a href="../index.html">Home</a>
        </li>
      </ul>
      <li class="sidebar">Developing Ideas</li>
      <li class="sidebar">Creating a Solution</li>
      <li class="sidebar">Evaluating</li>
    </ul>
  </div>
</aside>

Answer №2

When including a list within another list, make sure to nest it inside the parent list item.

<li>Some Content
    <ul>
        <li>More Content</li>
    </ul>
</li>
.sidebar ul {
    padding-left: 10px;
}

Remember to watch out for default margin and padding set by browsers as they may vary. Consider using a reset stylesheet or a pre-made CSS framework like Skeleton for consistent styling of form elements and grids.

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

Troubleshooting Bootstrap 4: hidden-md-up inconsistency

I'm trying to hide these menu bars with the class hidden-md-up, but it's not working. I'm using CDN but i've also tried the files and checked the class...can anyone help? Here's what I have <div class="col hidden-md-up"> ...

What is the CSS code to extend the width or length of a form field?

I am working with a form field box that has the class CCPPDisplayTD. I am attempting to increase its length using CSS styling. What is the best way to achieve this using CSS? ...

How can I modify the parent form element to only evaluate the expression at the text node, without affecting Angular interpolation?

Currently, I am in the process of developing an eCommerce platform and utilizing angular to construct a widget on product detail pages. Unfortunately, my control over the initial HTML rendered for the browser is quite limited. While most tasks related to m ...

Optimizing the speed and load performance of SQLite in Phonegap

As someone who is new to Android programming, I am seeking advice on how to optimize the performance of my phonegap SQLite application. Currently, it takes 30 seconds to load 150 words when I hit the refresh button. Can anyone provide tips on how to enhanc ...

Error message: Unable to locate frame and element identification failure

Currently, I am in the process of automating a web application using Selenium WebDriver. However, there is a specific scenario where the driver needs to switch to an iframe in order to interact with its elements. Despite my efforts to switch to the iframe, ...

Searching and indexing HTML content using Solrj in Java

I have knowledge on how to index a downloaded HTML page using the following code: ContentStreamUpdateRequest up = new ContentStreamUpdateRequest("/update/extract"); up.addFile(new File(fileName), solrId); up.setParam("literal.id", solrId); up ...

Creating HTML elements using JavaScript

Below is the code snippet in question: function getAllRecipes(){ $.ajax({ type: "GET", url: "https://api.npoint.io/7493fda05b8038212eed", beforeSend: function() { $("#AllRecipe").html('Fetching...') }, success: func ...

Create a canvas element to display an image within a picture frame

I am currently developing a customized framing website and aiming to showcase a frame example on the screen as customers input their dimensions. Progress has been made, but I am facing a challenge in cropping the image's corners using an HTML Canvas e ...

Utilizing the text field feature within Twitter Bootstrap 3.0 in-line styling

I am attempting to create a horizontal form with an inline text field split into two sections: one on the left and one on the right. The left side will contain horizontal text fields, some of which are inline, while the right side will have a mix of inline ...

history.js - failure to save the first page in browsing history

I have implemented the history.js library to enable backward and forward browser navigation on an AJAX products page triggered by clicking on product categories. While I have managed to get this functionality working smoothly, I am facing a particular iss ...

The CrispyError raised an issue because the `as_crispy_field` function was given a field that is either invalid or does not exist

I am currently developing a Django application that includes a contribution form. I have constructed the form using Django models and forms. However, upon attempting to run the application, I encountered the following error message. crispy_forms.exception ...

Adjustable Size with jQuery UI - Resizing Multiple Divs Causes Movement of Adjacent Divs

I've been experimenting with a webpage that consists of a div element containing multiple nested divs and jQuery UI resizable functionality. Essentially, it's a dashboard comprised of individual widgets. My goal is to resize each widget independe ...

Eliminate any div elements that do not contain tables

I am dealing with tables nested inside divs, and some of them are either empty, contain a single space, or have a single character like "-", which I refer to as EMPTY DIVs. What is the best way to use JavaScript to remove these EMPTY DIVs upon loading the ...

I've noticed that tailwindcss is causing issues with some of the styles in my angular project

Recently, I integrated tailwindcss 2.0.4 into my angular 11.2.6 project. After completing the installation and adding necessary imports, the appearance of the page had changed. Take this button for instance: https://i.sstatic.net/vvYVN.png Prior to int ...

Using the <mark> tag in CSS for creating padding

Struggling to utilize the padding feature in CSS effectively with the HTML below, as it only pads the first word on the left side: The current CSS code I have that's not working correctly: mark { background-color: #89ce40; color: white; opac ...

Show a stylish container when the server encounters an HTTP error with status code 500

My approach for error handling involves a straightforward ErrorHandler class structured like this: export class AppErrorHandler implements ErrorHandler { handleError(error : any){ //console.log('test error ', error.status); ...

Creating a multi-column layout with HTML and CSS

I'm currently exploring the most effective method to design this concept: https://i.stack.imgur.com/SOQp4.png The black square symbolizes small icons, accompanied by a heading and paragraph for each specific section. The icons need to align with the ...

The Flutter image blurs into a striking combination of red and black as the screen dimensions are altered

https://i.stack.imgur.com/YeZa6.png Hello everyone, we are facing an issue with Flutter web. Here's what's happening: When we use flutter run -d chrome --web-renderer canvaskit and flutter run -d chrome --web-renderer html, nothing changes. If ...

What is the process for automatically activating the Enter key once moving to the next text input field?

Hey everyone, I am looking for a way to automatically trigger the enter button after the user switches to another HTML input type='text'. This is necessary for form validation. Below is the code snippet: <input type="text" class="form-contro ...

The alignment of the text seem to be malfunctioning

The text-align:center property isn't working as expected. Can someone please assist me in figuring out why it's not functioning correctly? Here is the HTML code snippet: <!DOCTYPE html> <html> <head> <title>Wheat and ...