Why won't my second div with the unordered list show up?

I am currently working on developing a To-Do list application, and I have encountered an issue with the second div that contains an unordered list. The list is not displaying, and I am unsure of the reason behind this. I attempted to remove the div and add a new one with a simple hello message, but even that did not display. It seems like there may be a conflict with the first div causing this problem.

<!doctype html>
<html>
<head>
      <title>To Do list</title>

    <style type="text/css">

        #topBar-div{
            background-color: #F44336;
            position:absolute;
            top: 0px;
            width:100%;
            height: 150px;

        }

        body{
            margin: 0px;
            padding: 0px;
        }

        h1{
            color:white;
            margin-left: 300px;
        }

        #textInput{
            height: 30px;
            margin-left: 100px;
            width: 600px;
            font-size: 20px;
            color: #8E8E8E;
        }

        #addButton{
            height:37px;
            position:relative;
            top:-4px;
            right: 5px;
            width: 70px;
            color: grey;

        }

        #secondBar-div{
            color: grey;
            height: 350px;
            width: 1000px;
        }


    </style> 

</head>

<body>
    <div id="topBar-div">

        <h1>My To Do List</h1>

        <input type="text" value="Title..." id="textInput">

        <button id="addButton">Add</button>

    </div>

    <div id="secondBar-div">

        <ul>

            <li>Hit the gym</li>
            <li>Pay bills</li>
            <li>Meet George</li>
            <li>Buy eggs</li>
            <li>Study</li>
            <li>Cook Dinner</li>

        </ul>


    </div>


    <script type="text/javascript">


    </script>

</body>
</html>

Answer №1

The utilization of position absolute in the styling of the initial div (topBar-div) causes the second div (secondBar-div) to shift upwards and be positioned behind the first div.

To rectify this issue, you can include the following code in #secondBar-div:

margin-top: 150px;

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

What could be causing the error in this code's output?

Being new to PHP programming, I encountered an issue while trying inputting an HTML tag into a PHP file. This snippet generated an error: <?php $a = "Begin"; $b = 12; echo $b . " " . $a . " " . "This is a PHP file <br/>"; echo strlen($a); echo s ...

Tips for handling tasks with javascript in mongodb

The Mongo database is set up with a sharding structure of 3 Shards named TestSharding. Additionally, the script for this configuration can be written in JavaScript. I am tasked with developing a program that identifies whether a file is in .json or .csv f ...

What is the process for getting involved with npm commands?

Here is an excerpt from my package.json file: "scripts": { "cpFile": cp ../template/index.js /src/view/home/ } When I try to run the command: npm run cpFile fileName.js I expect it to execute: cp ../template/index.js /src/view/home/fileName.js How ...

Exploring Angular data iteration with Tab and its contentLearn how to loop through Tab elements

Upon receiving a response from the API, this is what I get: const myObj = [ { 'tabName': 'Tab1', 'otherDetails': [ { 'formType': 'Continuous' }, { 'formType& ...

By simply clicking a button, you can input a value into a field without the need for the page to refresh

Can someone please help me figure out how to insert a specific value into an input field without refreshing the page? I have tried the following code but it doesn't seem to work. Basically, when I click the button, I want the value "1234567" to be aut ...

Why am I unable to gather information from my nested React form?

Currently, I am developing a NextKs app with a form component. Within this component, some key/value pairs are nested (refer to the code snippet below). I initially believed that I could easily navigate through the elements in the form, but I encountered e ...

Is there a risk of encountering issues when preloading (or caching) an entire website using Ajax?

I am in the process of developing a portfolio website for an architect that includes numerous images on various pages. The navigation is implemented using history.js (AJAX). To improve loading times and enhance user experience, I have devised a script that ...

Express.js - What is the method to determine the total number of routes set up in my application?

Is there a way to calculate the total number of routes set up in Express.js without manually counting them? I have defined routes throughout my application and they are not grouped together, so I can't use a counter inside each one. I've searche ...

Converting JSON data to CSV format with JavaScript

I have been attempting to convert a JSON object to CSV using JavaScript, but the results are not as expected. UPDATE: The JSON object is stored in a variable, and every time I try to access 'list', it returns as undefined. Is there a way to acce ...

Align the inner container in the outer container-fluid

I'm struggling to center a container inside a container-fluid. Any suggestions on how to make it work? /* Setup Buttons Specific Styling */ .setup-bg { background: url("https://image.ibb.co/geAGqy/setupbtns_bg.png"); background-repeat: no-repea ...

Issues with Firefox Protractor testing functionality

Trying to test a protractor on an angularjs application using Firefox 47 has been unsuccessful. Attempted downgrading to version 46.0.1 after researching on Stack Overflow, but still facing issues. Has anyone discovered a working solution for this? It seem ...

A guide to implementing X-Frame-Options in an express.js web application using node.js

My dilemma involves serving static assets within iframes across various desktop and mobile web clients. Specifically, I am seeking guidance on how to whitelist a select group of origins for allowing the setting of X-Frame-Options headers. This will enable ...

Python's Dilemma: Dealing with For Loops

I am working on a PSP page that includes embedded HTML. I am trying to add another for loop to insert a %s next to background-color:, which will assign a suitable color to fill in the HTML table. Specifically, I want to include for z in colours to loop th ...

Dynamic sliding box jumps instead of simply fading in/out

My app features both a navigation bar and a sub-navigation bar. Within the sub-navigation bar, users can click on a button that triggers the appearance of another sub-bar while hiding the original one. The new sub-bar should smoothly slide out from behind ...

What is the best way to showcase the current element using jQuery?

I have this example: link HTML CODE: <div class="common-class"> <div class="trigger"> <span class="plus">+</span> <span class="minus">-</span> </div> <div class="show"></div> </div&g ...

Enabling Cross-Origin Resource Sharing (CORS) for Tomcat REST API

Recently, I set up a local Tomcat installation on port 8081 to expose a REST API. However, my development web server operates on port 9000. I want to make calls to the REST API from JavaScript code running in the browser using Angular's $http. Due to ...

Exploring the capabilities of Redux Toolkit's createEntityAdapter in designing versatile data grids

Seeking guidance on utilizing createEntityAdapter from Redux Toolkit. In my application, I display package information and details using the master/detail feature of the AG Grid library. Packages are loaded initially, followed by fetching detailed data as ...

Passing form data to a different route using express

I need to send the data from this form, located on the index.ejs page, to another page "/rentingForm" for rendering at the "rentingForm" page. Here is the snippet of code from my app.js file: app.use(bodyParser.urlencoded({ extended: true })); app.use( bo ...

Send data from the URL to PHP and then to Javascript in order to showcase the value within an input field

I need to pre-fill an email subscriber form with an email address from the URL. The specific email address is included in the following URL: http://www.domain.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dcacbdbbb9e3b9b ...

The React.useCallback hook in Cube.js is missing a dependency, specifically 'pivotConfig'. This could potentially cause unexpected behavior in the application

After multiple attempts at creating a straightforward dashboard using Cube.js with Windows 10 and MySQL version 8, I am feeling frustrated. Initially, I experimented with a JavaScript backend, struggled through the installation process for days, then attem ...