Positioning Problems with Popups

I have been facing an issue with the positioning of a popup in my trivia game. Despite trying multiple solutions, I have not been able to achieve consistency. Here is a snippet of the HTML code:

  <div class="logo">
   <img src="css/rio-40.png"/>
</div>
<div class="container" id="start">
  <div class = "question"></div>
  </br>
  <ul id="answers">
  </br>
  </br>
    <li class= "answer span" id= "A"></li>
    <li class= "answer span" id= "B"></li>
    <li class= "answer span" id= "C"></li>
  </ul>
</div>
<div class="container2">
  <div class="score"></div>
</div>

<div class="container3">
  <div class = "right-or-wrong" style = "display:none"></div>
  </br>
    <div class = "next" style = "display:none">Next question!</div>
      <div id="score again"></div>
        </div>

<div class="cd-popup" role="alert">
    <div class="cd-popup-container">
        <p> OH NO! <br /> You got 0 out of 3 correct. <br /> Brush up on your trivia <br /> and play again.</p>
        <ul class="cd-buttons">
            <li id="reset"><a href="#start">Play Again</a></li>
        </ul>
    </div>
</div>
<div class="cd-popup1" role="alert">
    <div class="cd-popup1-container">
    <img src="css/bronze-rio.png" />
    <p> You got 1 out of 3 correct. </br>Good job!</p>
        <ul class="cd-buttons">
            <li id="reset"><a href="#start">Play Again</a></li>
        </ul>
    </div>
</div>
<div class="cd-popup2" role="alert">
    <div class="cd-popup2-container">
    <img src="css/silver-rio.png" />
    <p>You got 2 out of 3 correct.</br>Awesome job!</p>
        <ul class="cd-buttons">
            <li id="reset"><a href="#start">Play Again</a></li>
        </ul>
    </div>
...

CSS:

@import url(https://fonts.googleapis.com/css?family=Slabo+27px);
body {
  /*background: ("css/background.png");*/
  background-color:  #21509d;
  ...
}

For the complete code and demo of the game, you can check it out on Codepen here or play the actual Game here.

Answer №1

The alignment of the questions and answers is influenced by the padding and dimensions. You may want to experiment with setting your containers' position property to absolute; while their parent container should have a position: relative; so that they are all aligned in one place.

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

Discover the power of integrating JSON and HTTP Request in the Play Framework

My aim is to develop a methodology that can effectively manage JSON and HTTP requests. This approach will facilitate the transition to creating both a Webapp and a Mobile App in the future, as JSON handling is crucial for processing requests across differe ...

Choosing an embedded iframe using selenium in javascript with node-js

When working with the selenium webdriver module in node-js, I encountered an issue trying to select a nested iframe within another iframe. Here's an example scenario: <iframe id="firstframe"> <div id="firstdiv"></div> <ifr ...

Looking to split the month and year input boxes when utilizing stripe version 7.2.0

Currently, I am utilizing ngx-stripe Version 7.2.0 to manage UI elements in Angular. I'm wondering if there is a method to split the Month and Year into separate text boxes within the UI of Angular 7 instead of having them combined into one field? ...

Leveraging PHP to execute a Python script

I am currently working on integrating a PHP code with a Python script (ring.py) and I need some help resolving an issue. <?php echo '<p>Hello World</p>'; $output = exec('python ring.py'); ?> The python scrip ...

I'm looking to redirect a 404 page in my PHP code - where is the best place to do so?

I found the correct code for redirecting 404 errors when a page is not found during redirection. However, I am unsure of where to implement this code in my PHP file. Should I place it within a specific tag on my home page? When I tried placing it at the ...

Best practice for displaying image data from PHP for use in Jquery

Struggling with a PHP function called by a jQuery function to display an image on a webpage. The problem seems to be in sending the data back to the jQuery function correctly. Here's how the image is retrieved: if(mysql_query("insert into Personal_P ...

Streamlining the process of implementing click events on elements selected by class using jQuery

Slowly but surely, I am gaining familiarity with jQuery and have reached the point where I desire to abstract my code. However, I am encountering issues when attempting to define click events during page load. Within the provided code snippet, my objectiv ...

Encountering a malfunction while executing an npm command specified in the package.json file

Currently, I am following a tutorial on Node, React, and Express on Udemy. In the tutorial, when I execute the command npm run data:import I encounter the following error: undefined npm ERR! code ELIFECYCLE npm ERR! errno 1 ...

Troubleshooting Issue 415: Adding and modifying database records through jQuery AJAX in ASP.NET 6.0 MVC Application

Implementing the Add/Edit functionality for categories in my project led me to utilize a modal (pop-up) to transfer data to the backend without refreshing the page. To achieve this seamless interaction, I opted for ajax integration. However, encountering a ...

Encountering the error "TypeError: Unable to access property 'findAll' of undefined" when using Sequlize

Currently, I am in the process of developing a CRUD Application utilizing PostgreSQL, Sequelize, and Express. I have been referring to this specific tutorial as my guide. However, it appears that there might be an issue with either my model or database con ...

How about representing a two-dimensional array in a point-free manner?

Exploring functional/tacit style programming, specifically implementing the snake game (example: ) The main issue at hand involves processing an array of strings like: [ ['2 '], ['10'] ] and obtaining a list of coordinates in numer ...

I encounter a black screen issue while attempting to rotate a three.js cube

How can I rotate a cube around all three axes (x, y, z) using the code snippet provided below? ` <html> <head> <title>CM20219 – Coursework 2 – WebGL</title> <meta charset="utf-8"> < ...

Fetching the exchanged messages between the sender and recipient - utilizing MongoDB, Express, and React for chat functionality

I am dealing with two collections named students and teachers in the mongodb database. The structure of a conversation between a student and a teacher involves arrays of messages within each object, as well as the IDs of the sender and receiver. I am seeki ...

A Comprehensive Guide on Implementing String Values in Highchart Series

When attempting to pass a string value (data) to the highchart series, I encountered an issue where it would display a blank chart. Is there a specific way to use a string value in the series of the highchart jQuery plugin? var data="{name: 'Jane&apo ...

Ways to implement jQuery for tables in a Ruby on Rails environment

I am a beginner in web app development with RoR and I could use some assistance with jQuery. On my webpage, I have a table displaying messages along with two moderation buttons - Accept and Decline message. .../view/messages/index.html.erb <div class ...

Using values from an appsettings.json file as href variables in an AMP html: a complete guide

Currently developing an AMP website with the URL www-dev.example.com, directing users to a sign-up page. The sign-up page is hosted on an identity server under the subdomain auth.www-dev.example.com. Now, the goal is to deploy the AMP website to a staging ...

Clicking a button on every row triggers an update to the data

As a beginner programmer, I am facing a challenge in selecting and updating data when clicking a button on each row. Currently, I am able to select and display data, but only the first update button is functioning. I suspect the issue lies in having the sa ...

Loop through a CodeIgniter database result object using Ajax

Hey there, I could really use your expertise on this one. I'm working with Codeigniter and my model is returning a database result object (not an array) to the controller. I need to iterate through this object using Ajax. Any suggestions on the best w ...

Eliminate the JSON object within jqGrid's posted data

The web page I'm working on features Filters with two buttons that load data for jqGrid when clicked. Clicking 'Filter' generates a postData json object and sends it to the server, which is working perfectly. However, I'm facing an is ...

How can you use JavaScript to identify resize or zoom changes across all ancestor DOM elements?

I have a DOM element that consists of a chart. <div id="plot1" class='plot-chart'></div> This specific DIV can be nested within various other DIVs. <div id="one" style="width:100%;height:100%;zoom:0.9;"> <div id="two"& ...