Alignment issue with header - not centered

Having an issue with my pop-up window where the header is misaligned to the left, possibly due to the close button. Can anyone provide assistance?

Below is the CSS code for reference:

.popUpModal{
    display: none;
    width: 100%; 
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    position: fixed;
    top: 0;

    justify-content: center;
    align-items: center;
    text-align: center;
}

.popUpContent{
    padding-bottom: 20px;
    width: 50%;
    height: 80%;
    background-color: white;
    border-radius: 8%;

    display: inline-block;
    justify-content: center;
    vertical-align: center;

    font-family: "Source Sans Pro",sans-serif;
}

.close{
    float: right;
    margin-right: 5%;

    font-size: 40px;
    transform: rotate(45deg);
    font-weight: bold;
    cursor: pointer;
}

.trainingPopUpHeader{
    margin-top: 4%;
    font-size: 40px;
    text-decoration: underline;
}

.trainingPopUpDescription{
    font-size: 20px;
    margin-top: 4%;
    margin-left: 10%;
    margin-right: 10%;
}

.trainingStepList{
    font-weight:bold;
    text-align: left;
    font-size: 30px;
    margin-left: 4%;
}

.trainingVideo{
    height: 35%;
    border-radius: 5%;
    margin-bottom: 3%;
}
   <div class="popUpModal" id=popUpModal>
        
        <div class="popUpContent">
            <div class="close">+</div>
            <h1 class="trainingPopUpHeader">How to Change Labels</h1>
            <div  class="trainingPopUpDescription">
                <p>When the labeler machine runs out of labels, it is up to one of the associates to 
      replace the labels
                 so the machine can continue running. It is important to be quick and accurate when 
     reloading the labels. 
                 Watch the video and read the step-by-step instructions to complete this training.    
                </p>
            </div>
            <div class= "trainingStepList">
                <p>
                    1. Pull off used back paper <br>
                    2. Find new pack of front & back labels <br>
                    3. Insert front labels onto the front left roller <br>
                    4. Insert back labels onto the front right roller <br>

                </p>
            </div>
            <video class="trainingVideo" controls>
                <source src="testVid.mp4">
            </video>

                            <!--add video element-->
                            <!--add step by step instructions-->
                                            
            <!--need a text header, a step by step instruction list, a video, and an input form for name-->
        </div>  
   

    </div>

https://i.sstatic.net/cU5YI.png

Seeking insights on why the header appears misaligned due to the close button in my pop-up window.

Answer №1

It would be better next time to utilize code snippets

https://codesandbox.io/s/twilight-voice-9s0zu

To improve visibility, I have adjusted the width of the popup from 50% to 80%

The issue lies with your close button. Specifically, it is related to the float property. There might be a misconception that it is removed from the website's flow, but in reality, it is simply shifted to the edge of the container or another floated element, still occupying space. To address this, consider using position: absolute along with right: x px for proper alignment.

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

The CSS3 Animation must come to a halt once it reaches the 75% mark

Is there a way to pause a CSS3 animation at 75% and prevent it from resetting to 0% when completed, or alternatively add a 10-second delay at 75%? Currently, the animation restarts at 0% once it reaches 100%. div { width: 100px; height: 100px; bac ...

Revamp the layout of the lower HTML video menu

Here is my code: <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> video { width: 100%; height: auto; } </style> </head> <body> <video width="400" controls> ...

Arrangement containing 4 separate div elements - 2 divs are fixed in size, 1 div adjusts dynamically (without scroll), and the remaining div fills the

I am trying to implement a specific layout using HTML and CSS on a webpage. So far, I have successfully created the black, red, and blue areas, but I am facing challenges with the scrollable green content. It currently has a static height, but I need it to ...

Display Page Separation with JavaScript

I am working on a project where I have created payslips using Bootstrap through PHP. To maintain organization, I am looking to create a new page after every 6 payslips. Below is the code snippet that I am using to generate the payslips: foreach($results a ...

Utilize Bootstrap 4 to seamlessly integrate a small element between two lengthy items in a row, ensuring a gap

I would like to achieve a similar look to this design. https://i.sstatic.net/p1hq4.png hr { border: none; color: black; background-color: black; height: 5px; margin-top: 10px; } <div class="row code-line"> <div class="col-5 ...

Tips for implementing a Dialog Box within a Card Action Button Group

I'm currently exploring the option of incorporating a Dialog box as a button within a Button Group, which is then nested inside a CardActions component in Material UI. Previously, I had success with using regular Buttons instead of a Dialog, where th ...

Internet Explorer 8 is not compatible with jQuery fadeIn and fadeOut functions

Recently, I created a script that allows for fading in and out an error container. Surprisingly, it seems to work perfectly in Firefox and Chrome but unfortunately fails to function altogether in Internet Explorer 8. If you're interested, feel free t ...

Can you explain the concept of "cascading" within CSS?

Can someone kindly explain the specific definition of "Cascading" in Cascading Style Sheets (CSS)? I have heard conflicting perspectives on this topic, so I am seeking clarification here. Any examples to illustrate would be greatly appreciated. ...

using a CSS tag to vertically center text within an element

After using a tag and setting the background color, height, and width for my content, I decided to align the text in the center along the x-axis using text-align: center;. However, I am now trying to figure out how to align it in the middle along the y-ax ...

Eliminating the admin-bar.php styling in a WordPress theme

Currently, I am working on developing my very first WordPress template. I have encountered an issue with the top navigation being pushed down by a specific style rule: html { margin-top: 32px !important; } After investigating further, I discovered that t ...

Ways to conceal an HTML element using CSS

I am working with two images, but I only want to display one at a time. When I hover over the image, I want it to change. .sidenav { height: 100%; /* 100% Full-height */ width: 100px; position: fixed; /* Stay in place */ z-index: 2; top: 0 ...

Ensure that the child element stays within the parent container by using the max-top property for relative

Check out this HTML code snippet: https://jsfiddle.net/1t68bfex/ button { position: relative; top: 100px; left: 150px; max-top: 10px; } .third-party-block { //display: none; } <div style="border:1px solid red;"> <button> ...

Is it possible to achieve a 300 dpi resolution when printing an HTML page?

I've encountered an issue with my web page. It is encoded in HTML and CSS and designed to be the size of an A4 page (300dpi) at 2480 x 3508 pixels. However, when I try to print the page, it is printing in a resolution of 72/96 dpi and splitting into ...

Overlap in Bootstrap 4 Sections

I'm facing an issue with two sections on my website. They are properly separated until a certain size, https://i.sstatic.net/e52t2.png, but when the size is reduced, they start to overlap https://i.sstatic.net/aMtHr.png. Below is a snippet of my code: ...

The process of overriding CSS applied through JavaScript

I am using a third-party multi-select dropdown. Similar to Select2, the multi-select dropdown is created using JQuery with select2.min.js and the width of the dropdown is automatically calculated. Is there any way to apply static width to it, as I believe ...

Unable to place text inside an image using Bootstrap

My issue pertains to text placement on images, which is behaving oddly in my code. The problem seems to stem from a hover system I have implemented, where the text only displays correctly when triggered by a hover event. My code snippet below addresses the ...

I am facing an issue where PayPal buttons are overlapping other elements on my website. Unfortunately, I am unable to control the

Having integrated PayPal buttons on my Magento website, I am facing an issue where the buttons have their CSS classes inline. This causes them to overlap other elements on the page when scrolling. For instance, as I scroll down, the PayPal button overlaps ...

Assistance in configuring Zurb Foundation 5 for optimal integration with Laravel

As a relatively new user to Laravel with previous experience using older versions of Foundation, I am currently in the process of setting up a new Laravel project. My goal is to integrate the Foundation framework into my project, but I find myself a bit co ...

Expanding all cards in a Bootstrap collapse when one is clicked

Hello, I am currently working on integrating bootstrap collapse into a section of my django application. Here is the code snippet that I have implemented so far: {% extends 'base.html' %} {% block content %} <div class="container"> & ...

Align text to the right and left side

HTML file: <div id="home"> <b><p class="split-para">java<br><a href="j_temp.html" class="float">temperature converter in terminal</a> <br> <a href="j_palindrom.html" class="float">palindrome checker</a& ...