When I try to add more content to my page, it doesn't extend beyond a single page and instead gets compacted together

As a beginner in the world of coding, my goal is to create a time management website specifically tailored for school use. Despite copying this code multiple times, I have encountered an issue where it does not continue down the page, and I am unsure of the reason behind this sudden halt.

<html>
<style>
     
.title {
    text-align: center;
    font-size: 45px;
    color: #b72121;
}
     
    </style>
<header>
<title>ManageMe</title>
</header>
<body>
<div>
<h1 class= "title"> ManageMe </h1>
    <font face = "Times New Roman" size = "7">Next 7 Day Outlook</font><br />
    <div> 
        <h2> Today <span class= "june13">June 13</span></h2> 
        <div class="line1">
            <div> 
    <br />
                <div id= "bonus" />
                <input id= "first" type="text" name="firstname" value="Enter Task Here">
                <br />  
                <div>
                    <button class="button" onclick ="addtask()"> Add Task </button>
                    <div id="div">
                        <div> 
                            <h2 class= "tom"> Tomorrow <span class= "june14">June 14</span></h2> 
                            <div class="line2"> 
                                <div>
               
                                    <div>
                                        <br /> 
                                        <div id= "bonus1" />
                                        <input id= "first1" type="text" name="firstname" value="Enter Task Here">
                                    </div>
                                    <button class="button1" onclick ="addtask1()"> Add Task </button>
                                </div>
                                <div> 
                                    <h2> Satuday <span class= "june14">June 15</span></h2> 
                                    <div class="line3"> 
                                        <div>
                                            <div>
                                                <br /> 
                                                <div id= "bonus2" />
                                                <input id= "first2" type="text" name="firstname" value="Enter Task Here">
                                            </div>
                                            <button class="button2" onclick ="addtask2()"> Add Task </button>
                                            <div>
                                            <div> 
                                                <h2> Sunday <span class= "june16">June 16</span></h2> 
                                                <div class="line4"> 
                                                    <div>
                                                        <div>
                                                            <br /> 
...

Identifying the problematic part within the code snippet:

<div>
    <div> 
        <h2>Sunday <span class= "june16">June 16</span></h2> 
        <div class="line4"> 
            <div>
                <div>
                    <br/> 
                    <div id= "bonus3" />
                    <input id= "first3" type="text" name="firstname" value="Enter Task Here">
                </div>
                <button class="button3" onclick ="addtask3()">Add Task</button>
            </div>
        </div>
    </div>                      
</div>

Seeking assistance with the functionality that allows for adding tasks on a given day. Additionally, I aim to implement priority levels using colors but lack the know-how. Any guidance or support is greatly appreciated as I embrace learning the basics of coding. Thank you!

Answer №1

To start, it's important to tidy up your code. Class names should be used to group elements that have the same appearance. For example, in your case, instead of using line1, line2, etc., they should all be named line. If you need to access elements separately, use IDs (for example, buttons).

The issue with the appearance is that the height of the line class is set to 2px, and since it wraps the entire section, the whole section ends up with a height of 2px. I've cleaned up your code and provided an example of how it could look (note that the class name june13 should also be renamed to something like date). To add more dates, simply copy the section and adjust the values for the input id and button function.

function addtask() {
    var first = document.getElementById("first").value;
    document.getElementById("bonus").innerHTML += "<p>" + first + "</p>";
}

function addtask1() {
    var first = document.getElementById("first1").value;
    document.getElementById("bonus1").innerHTML += "<p>" + first + "</p>";
}

function addtask2() {
    var first = document.getElementById("first2").value;
    document.getElementById("bonus2").innerHTML += "<p>" + first + "</p>";
}

function addtask3() {
    var first = document.getElementById("first3").value;
    document.getElementById("bonus3").innerHTML += "<p>" + first + "</p>";
}
.title {
text-align: center;
font-size: 45px;
color: #b72121;
}

.june13 {
font-family: "Times New Roman", Times, serif;
font-size: 14px;
color: #989da5;
margin: 0px;
padding: 0px;
}

.line1 {
width: 30%;
height: 2px;
background-color: #666;
margin-bottom: 10px;
}

.button {
font-size: 10px;
cursor: pointer;
outline: none;
color: #fff;
background-color: #4CAF50;
border: none;
border-radius: 15px;
box-shadow: 0 9px #999;
height: 25px;
width: 70px;
}

.button:hover {
background-color: #3e8e41
}

.button:active {
background-color: #3e8e41;
box-shadow: 0 5px #666;
transform: translateY(4px);
}

input {
margin-bottom: 10px;
}
<html>
  <header>
    <title>ManageMe</title>
  </header>
  <body>
    <h1 class= "title"> ManageMe </h1>
    <font face = "Times New Roman" size = "7">Next 7 Day Outlook</font>
    <br />
    <!--DAY SECTION START-->
    <h2> Today 
      <span class= "june13">June 13</span>
    </h2>
    <div class="line1"></div>
    <div>
      <div id="bonus"></div>
      <br>
      <input id= "first" type="text" name="firstname" value="Enter Task Here">
      <br>
      <button class="button" onclick ="addtask()"> Add Task </button>
    </div>
    <!--DAY SECTION END-->
    <!--DAY SECTION START-->
    <h2> Tomorrow 
      <span class= "june13">June 14</span>
    </h2>
    <div class="line1"></div>
    <div>
      <div id="bonus1"></div>
      <br>
      <input id= "first1" type="text" name="firstname" value="Enter Task Here">
      <br>
      <button class="button" onclick ="addtask1()"> Add Task </button>
    </div>
    <!--DAY SECTION END-->
  </body>
</html>

Answer №2

Looks like those nested divs are reminiscent of the old Dreamweaver days! Here's a method to streamline and eliminate many of those divs. The initial wrapper div is retained with an added id of "container" for some additional padding. The h2 tags are styled with margins to prevent them from merging together.

     
     function addtask() {
        
       var first = document.getElementById("first").value;
       document.getElementById("bonus").innerHTML += "<p>"+first+"</p>";
         
      
         }
        
         function addtask1() {
        
       var first = document.getElementById("first1").value;
       document.getElementById("bonus1").innerHTML += "<p>"+first+"</p>";
         
      
         }
                 function addtask2() {
        
       var first = document.getElementById("first2").value;
       document.getElementById("bonus2").innerHTML += "<p>"+first+"</p>";
         
      
         }
        function addtask3() {
        
       var first = document.getElementById("first3").value;
       document.getElementById("bonus3").innerHTML += "<p>"+first+"</p>";
         
      
         }
        
// CSS Snippet
.line1 {
    width: 30%;
    height: 2px;
    background-color: #666;
    margin-bottom: 10px;
}

.button {
    font-size: 10px;
    cursor: pointer;
    outline: none; 
    color: #fff;
    background-color: #4CAF50;
    border: none;
    border-radius: 15px;
    box-shadow: 0 9px #999;
    height: 25px;
    width: 70px;
}
         

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

Mastering Tooltip Placement Using CSS or JavaScript

I have been working on creating a CSS-only tooltip for a web application and so far I have managed to create some useful tooltips with different classes: tooltip-up tooltip-down tooltip-left tooltip-right The distinguishing factors between them are t ...

Submitting dataURL via Ajax using multipart/form-data

I'm currently working on a program that is responsible for extracting a dataURL from a canvas element and then transmitting it to the server side for conversion back into a JPG file. Now, my next step involves retrieving this image from the server pro ...

Is it possible to use velocity js to add a gradient color effect to text content?

Can I use velocity js to apply gradient color to text? I've looked at https://css-tricks.com/snippets/css/gradient-text/ My specific need is to dynamically add a changing gradient using js. Thank you in advance. ...

show numerical values as images in sql

Currently, I'm in the process of developing a website for a neighbor who is considering opening a new restaurant. One of the features I need to work on is a page dedicated to testimonials and reviews from customers. My goal is to use SQL to store the ...

Managing content in two separate divs at the same time using AJAX

I am curious to know how I can achieve a functionality where editing the text field on the left will automatically update the text field on the right. I have a feeling that it involves using AJAX, and I would like to implement it as well. Can anyone guid ...

Creating Diverse Pages with Unique Variables on Identical Layouts in Jekyll

I am currently using Jekyll to create static HTML pages, but I want to have the ability to generate similar layouts with different variables. Let me provide a simple example to illustrate my point: _config.yml title: Foo and Bar Generated index.html &l ...

webpack - compile one TypeScript file separately (2 actions)

In summary... When my Vue files are combined with background.ts, webpack processes them to create bundled vue files along with background.js I'm unable to run the background.js script I expected background.js to only contain "console.log(' ...

Utilizing the power of THREE.ShaderLib.phong while integrating subsurface scattering within ThreeJS

My mesh utilizes a ShaderMaterial with THREE.ShaderLib.phong uniforms. I have successfully linked the map, bump, and specular maps textures. The code snippet below demonstrates this: defines = {}; defines["USE_MAP"] = ""; defines["USE_BUMPMAP"] = ""; defi ...

Incorrect pathing in express.js

I've encountered an issue with my filter while attempting to redirect packages using two express.js routes: app.get('/billdetails/:year/:month/:phoneId', function (req, res, next) { var db = req.db; var year = req.params.year; v ...

The controller in ng-controller returns an undefined error when loaded using RequireJs

I have encountered an issue while loading the Angular application using requirejs. The ng-controller written in main.html loads directly but ends up being undefined. app.js define(['sfongApp', 'ng-grid', 'angular-bootstrap'] ...

Integrating data between Java and JavaScript within the Wikitude platform is essential for leveraging AR.RelativeLocation

After passing an integer from Java to JavaScript, I am attempting to use the value to adjust the altitude of an object. I included the variable in RelativeLocation var location = new AR.RelativeLocation(null, 8, 0, a); The issue arises when it disregards ...

Text box content does not refresh unless the page is reloaded

My text box (tbAdresse) is initially empty. I'm using the following JavaScript code to set its value: origin = document.getElementById("tbAdresse").value; if (origin == "") origin = <%=this.GetFormatStringCoordonnees("Paris")% ...

Duplicate entries being saved in the database due to Ajax calls

I am currently utilizing Fullcalendar jQuery with PHP for managing events. I am making an AJAX call to add events, and while it works fine for the initial event entry after a page refresh, it starts creating duplicate events for subsequent entries. I am un ...

The jQuery carousel script is not functioning

Currently developing a jQuery slideshow for my website, and I stumbled upon a code that fits my requirements perfectly. I made some adjustments to the code from this source: . My specifications were that the code should be created from scratch, lightweight ...

Send a vanilla JavaScript ajaxForm submission by completing the form

I am currently in the process of integrating JavaScript from an iOS application into a web application. I have control over the code for both apps. My objective is to develop a JavaScript function that can receive input from a barcode scanner, populate a w ...

Angular UI-Select's issue with duplicating tags while adding objects for tagging functionality

I have implemented the ui-select library to enable the "Tagging" feature in my project. Currently, I am utilizing an Array of objects where each object contains an id and a name. The functionality is working as expected. However, when a user types in a n ...

Toggling markers according to form selections is not functioning

My goal is to dynamically show or hide markers on my Google Map that represent houses and condos, based on the features selected by the user from a select box with id #features. For example, if a user picks 'Swimming Pool' as a feature and click ...

Including JavaScript in HTML Error 404

https://i.stack.imgur.com/aQDPG.png I am struggling to understand why this import is not functioning as expected. I have tried using script/import.js but it still fails to work. The error message I keep receiving is: 127.0.0.1 - - [09/Sep/2020 15:09:35] ...

centering pictures vertically on my webpage

Below is the code I am currently working with. It displays an image on the left and a description with a button on the right, side-by-side within the "promo_box_wrapper" container. However, I'm struggling to vertically align the image within its surro ...

Steps for implementing an onclick action in Angular 4 from infowindow content

Currently, I am integrating Google Maps into an Angular 4 project and I need to implement a click event inside the infowindow. How can I achieve this? I attempted the following code but encountered an issue where the name is undefined. Even though I called ...