Checkboxes within div elements are unresponsive to clicks

As a novice, I am facing a simple issue.

When I place an input checkbox inside the #container div, it functions correctly. However, when I try to put them within the #container div > #section div, they fail to work.

*,
html,
body {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
}

#content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-content: center;
  flex-wrap: wrap;
}

@media only screen and (orientation: portrait) {
  #content {
    flex-direction: column;
  }
}

.section {
  width: 33%;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

#today-tasks,
#upcoming-tasks,
#recurring-tasks {
  width: 100%;
  height: auto;
}

.task {
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
}


/* Text */

.title {
  flex: 0;
  padding: 4px;
  font-size: 4vw;
}

.task-text {
  font-size: 6vw;
}

@media only screen and (orientation: landscape) {
  .title {
    font-size: 3vh;
  }
  .task-text {
    font-size: 6vh;
  }
}
<body>
  <div id="content">
    <div class="section" id="today">
      <div class="title">
        <h4>today</h4>
      </div>
      <ul id="today-tasks">
        <li class="task">
          <p class="task-text">task</p>
          <input type="checkbox" />
        </li>
      </ul>
    </div>
    <div class="section" id="upcoming">
      <div class="title">
        <h4>upcoming</h4>
      </div>
      <ul id="upcoming-tasks">
        <li class="task">
          <p class="task-text">task</p>
          <input type="checkbox" />
        </li>
      </ul>
    </div>
    <div class="section" id="recurring">
      <div class="title">
        <h4>recurring</h4>
      </div>
      <ul id="recurring-tasks">
        <li class="task">
          <p class="task-text">task</p>
          <!-- <label for="toggle"><input type="checkbox" id="toggle" /></label> -->
          <input type="checkbox" />
        </li>
      </ul>
    </div>
  </div>

Answer №1

There were multiple unnecessary instances of height:100%; width:100%; that were creating some clutter in your output, so I took the liberty to organize your code a bit.

*,
html,
body {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

#content {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-content: center;
  flex-wrap: wrap;
}

@media only screen and (orientation: portrait) {
  #content {
    flex-direction: column;
  }
}

.section {
  width: 33%;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

#today-tasks,
#upcoming-tasks,
#recurring-tasks {
  width: 100%;
  height: auto;
}

.task {
  display: flex;
  justify-content: center;
  flex-direction: row;
  align-items: center;
  padding: 8px;
}


/* Text */

.title {
  flex: 0;
  padding: 4px;
  font-size: 4vw;
}

.task-text {
  font-size: 6vw;
  padding-right:5px;
}

@media only screen and (orientation: landscape) {
  .title {
    font-size: 3vh;
  }
  .task-text {
    font-size: 6vh;
  }
}
<body>
  <div id="content">
    <div class="section" id="today">
      <div class="title">
        <h4>today</h4>
      </div>
      <ul id="today-tasks">
        <li class="task">
          <p class="task-text">task</p>
          <input type="checkbox" />
        </li>
      </ul>
    </div>
    <div class="section" id="upcoming">
      <div class="title">
        <h4>upcoming</h4>
      </div>
      <ul id="upcoming-tasks">
        <li class="task">
          <p class="task-text">task</p>
          <input type="checkbox" />
        </li>
      </ul>
    </div>
    <div class="section" id="recurring">
      <div class="title">
        <h4>recurring</h4>
      </div>
      <ul id="recurring-tasks">
        <li class="task">
          <p class="task-text">task</p>
          <!-- <label for="toggle"><input type="checkbox" id="toggle" /></label> -->
          <input type="checkbox" />
        </li>
      </ul>
    </div>
  </div>

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 with Javascript redirect not working following form submission in combination with Asp Classic

After countless hours of research and experimentation, I find myself at a standstill. My web page is coded extensively, so I'll do my best to provide a concise summary. The core elements of my ASP CLASSIC page for creating tickets via a form are as f ...

What is the best way to position href text on the top of a rectangular div box?

Whenever I try to position the text above the rectangle, it disables the link. How can I resolve this issue? Additionally, when attempting to change the color of the "San Diego" text, I'm unable to adjust its position. Just a heads up, I am new to HT ...

Can the style of certain words within a paragraph be altered using CSS only, without the need for any HTML tags?

Is it feasible to alter the appearance of certain words within a paragraph using CSS solely, without applying any HTML tags to those particular words? Awaiting a positive response. Thank you! ...

Guide to converting a specific tag into div using Javascript

I am working with some HTML code that includes a div: <div class="myDiv"> <a href="" title="">My link</a> <p>This is a paragraph</p> <script>//This is a script</script> </div> Additionally, I ha ...

Issues arising from the visibility and concealment of elements using bootstrap

Struggling with hiding certain content in my code. I'm fairly new to coding, having just started about a week ago. So far, I've learned HTML, CSS (which I find the most important), and how to utilize Bootstrap 4. My issue lies in wanting to hide ...

After a group of floated items, there will be an automatic "clear: both" applied

Within my Content Management System, I have custom Elements that need to be floated next to each other. Instead of adding an extra div with a class of "clear", I want to automatically insert a clear: both at the end using CSS3. I attempted this workaround ...

Tips on toggling between slides with Bootstrap Carousel

I am in the process of designing a portfolio website and have encountered a challenge. I want to divide it into two sections - a brief introduction and a carousel for showcasing projects. While I have managed to set up both sections, I'm facing an iss ...

expanding the input and duplicating the outcomes

I'm attempting to clone and add values to results in my project. Here's the link to what I have so far: http://jsfiddle.net/QNP3r/175/ Currently, it is functioning adequately with a table element. However, I'd like to make it work with a di ...

Tips for Implementing Color-coded Manchu/Mongolian Script on Your Website

My journey began with a seemingly straightforward task. I had a Manchu word written in the traditional script and I wanted to change the color of all the vowels in the word (ignoring ligatures). <p>ᠠᠮᠪᡠᠯᠠ ᠪᠠᠨᡳᡥᠠ</p> < ...

Achieve full height in Grid component of material UI by eliminating margins

In this codesandbox example, I have successfully set the grid container height to full using 100vh. However, there is an issue with a margin of 8px being added by the user agent to the body element, and I'm struggling to find a solution to remove it. ...

Improper layout on laptop screens with smaller dimensions

The design looks great on a 24-inch laptop, but on an 11-inch screen, the layout becomes distorted. The right column shifts down... Check out the layout here Below is my code: <div class="row" style="margin-left: 325px;"> <div class="span12 ...

Creating a Form Input Field Based on a Selection List

I'm in the process of developing a small app to boost my productivity at work. Currently, I have some html/js code that includes a ul with a search filter. When I select an option, it opens a new tab with relevant text. Ideally, I want the outcome to ...

What could be causing the lack of downward rotation of my arrow in css? (specifically, the span element)

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=de ...

Discover the child of the delegated event div using jQuery

Can you assist me in resolving this issue? My HTML structure appears as follows: <div id="main-randompart"> <!--Inserted into the DOM during runtime--> <div class="close"> X </div> <img src="somesrc..."> ...

Create a custom navigation bar using PlayFramework for a unique video streaming website

Attempting to create a dynamic navigation bar in Play using the code below in my main.scala.html file: @(title: String)(content: Html) <!DOCTYPE html> <html lang="en"> <head> <title>@title</title> <li ...

Applying identical values to multiple properties (CSS)

Can we assign a single value to multiple CSS properties at once? border-left, border-right: 1px solid #E2E2E2; Similar to how we can with selectors? .wrapper, .maindiv { ... } ...

Guide to inserting text into an html element upon clicking an ASP:Button

In my code, there is a DIV that holds some text. Accompanying the text is an asp:Button. When this button is clicked, I aim to access and save this particular text. Nonetheless, it seems that once the button is clicked, the content of the DIV resets - lik ...

I'm currently experiencing a challenge with a project I'm tackling that specifically deals with chart.js

In my recent coding project, I created a script to gather user input and then present it in various chart formats. However, upon executing the code, the selected chart fails to display after inputting values and clicking on the "generate chart" button. Her ...

Using regular expressions to search for HTML tags in PHP may result in empty tags being overlooked

I have a question about using regular expressions to remove hidden tags along with the ending tag. It appears to be working, but there is one issue I am facing. After removing the elements, it leaves behind "<>" for all the found elements. Here is t ...

Select all feature in checkbox is malfunctioning

I need to implement a feature with 3 checkboxes: When the "A" checkbox is clicked, only "A" should be highlighted. Upon clicking the "C" checkbox, only "C" gets highlighted. If the "B" checkbox is clicked, both "A" and "B" nee ...