Attempting to consolidate div elements

Trying to center the DIV .dollar and .euro is proving to be quite a challenge, regardless of what I attempt. Below is all the HTML and CSS that I have been working with. Your assistance in resolving this issue would be greatly appreciated.

    .App {
      text-align: center;
    }
    
    @media (prefers-reduced-motion: no-preference) {
      .App-logo {
        animation: App-logo-spin infinite 20s linear;
      }
    }
    
    .App-header {
      background-color: #282c34;
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      font-size: calc(10px + 2vmin);
      color: white;
    }
    
    .texto{
      place-self: flex-end;
      margin: 0px 20px 13px 20px;
    }
    
    .Real_Rapido{
      margin: auto;
      width: 900px;
    }
    
    .dolar{
      padding-top: 20%;
    }
    
    .dolar, .euro{
      display: flex;
      vertical-align: bottom;
    }
    
    .euro{
      padding-top: 10%;
    }
    
    .cotacao{
      display: flex;
    }
    
    .cotacao, .simbolo{
      font-size: 2em;
    }
    
    .cotacao input{
      font-size: 2em;
      border: none;
      outline: none;
      text-align: right;
    }
    
    .moeda{
      width: 150px;
      color: #778899;
    }
    
    .bandeiras{
      position: absolute;
      padding-left: 100px;
      height: 68px;
      margin-top:-20px;
    }
    
    .simbolo{
      position: relative;
      color: #D3D3D3;
      width: 118px;
      text-align: right;
    }
    
    .eua{
      background: transparent url(eua.png) no-repeat center;
      background-size: 100px;
    }
    
    .br{
      background: transparent url(brasil.png) no-repeat center;
      background-size: 100px;
    }
    
    .ue{
      background: transparent url(ue.png) no-repeat center;
      background-size: 100px;
    }
    <html lang="en">
    <head>
      <link rel="stylesheet" href="stylee.css">
    </head>
      <body>
        <div id="root">
          <div class="Real_Rapido">
            <div class="dolar">
              <span class="cotacao">
                <span class="bandeiras eua"></span>
                <span class="simbolo">US$</span>
                <input type="text" class="moeda" value="1.00">
              </span>
              <span class="texto">está valendo</span>
              <span class="cotacao direita">
                <span class="bandeiras br">   </span>
                <span class="simbolo"> R$ </span>
                <input type="text" class="moeda" value="5.06">
              </span>
            </div>
            <div class="euro">
              <span class="cotacao">
                <span class="bandeiras ue">   </span>
                <span class="simbolo"> € </span>
                <input type="text" class="moeda" value="1.00">
              </span>
              <span class="texto">está valendo</span>
                <span class="cotacao direita">
                <span class="bandeiras br">   </span>
                <span class="simbolo"> R$ </span>
                <input type="text" class="moeda" value="5.50">
              </span>
            </div>
          </div>
        </div>
      </body>
    </html>

The use of 'flex' seems to be causing some issues in achieving centralization, but removing it breaks everything apart. If you have any insights or solutions, I would greatly appreciate an explanation along with the fix. Thank you for your help!

Answer №1

To center-align the content, simply include "justify-content: center" in the styles for both the .dolar and .euro classes.

The justify-content CSS property determines the horizontal alignment of content within a flex container.

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

Troubleshooting issues with dropdown functionality in HTML when using Bootstrap

I'm encountering an issue with my dropdown menu not functioning properly when using bootstrap. The dropdown only appears on screens smaller than the $md variable. The problem arises when I try to click on the dropdown icon and it does not respond as ...

Retrieve option attributes using Select2's formatResult method

How to Retrieve Custom Data Attributes in select2 using <select> We are looking for the same functionality as described in the provided link. However, is there a way to access the attributes of an option element within the formatResult function? ...

Create a variable and set it equal to the value of a form

I'm having trouble setting a value to a hidden form field that needs to come from a query string parameter. The function that extracts the query string parameter is working properly, but the function that assigns this variable to the hidden form field ...

Extract particular details from my database

I need help creating a table to display all chat messages sent to the server. I have the table set up, but now I want to make it so that when I click on a user's name like 'demo', it will show me all the chat messages sent by that specific u ...

Position elements in the center of the page at 33.3333% width

I'm facing a challenge with centering elements that are floated left and have a width of 33.33333% on the page. I want the text inside these elements to remain aligned to the left, but I'm unsure how to go about centering the items: ul.home-pr ...

The page's dimensions exceed the size of the device screen

I created this basic HTML content using React <!doctype html> <html><head><title data-react-helmet="true"></title><style type="text/css" data-styled-components="" data-styled-components-is-local="true"></style>< ...

Issue with the Ajax auto-complete feature in Internet Explorer

I am facing an issue with my "ajax suggestion list" getting hidden behind the "select menu" located right below the text box that triggers the ajax function. This problem only occurs in IE 6.0, while it works fine in other browsers. I have already disabled ...

How to select specific elements with jQuery nth-child selector without skipping any

As a newcomer to jquery, I may not be able to grasp more advanced concepts right away. However, here's my issue: when attempting to select the nth-child(1), it correctly chooses the first item (I realize I could use first child, but I prefer not to). ...

Issues with font face rendering on Android Chrome and Firefox devices

I'm currently encountering an issue with the font face in CSS3. The code I have been using is as follows: @font-face { font-family: James Fajardo; src: url('https://www.twoseven.nl/kurkorganicwines/wp- content/themes/kurk/fonts/James_Fajardo.t ...

Issue where the link in the first column of a horizontal scrolling table is unclick

In my attempt to create a fixed first column horizontal scrolling table, I encountered an issue where hyperlinks in the first column become unclickable once scrolled to the right. This seems to be because the fixed column is not clickable by default, and o ...

Styling images with text alignment in CSS

I'm trying to figure out how to align an image to the left, some text to the top right, and some text to the bottom right. The parent div contains a background image. <div id="parent" style="background: url(bg.jpg) repeat-x left top"> <i ...

Interact with one div to trigger changes in another (CSS)

I successfully influenced the style of one div when hovering over another div using the "+" selector, but I would prefer to find a different solution. My goal is for this interaction to work even if the .h div and the .t div are located in separate parent ...

What could be causing the issue with absolute positioning not functioning correctly?

I'm having trouble keeping my footer at the bottom of the page: body, html{position:relative;} footer{position:absolute;} Even when I use bottom: 0;, the footer doesn't seem to go all the way to the bottom. Is there anyone who can help me troub ...

Storing HTML elements in a database using jQuery's html() method

I have encountered a dilemma that has left me stumped after extensive online research. I have a dynamically generated webpage and need to save the entire appended body of the page to a database using PHP and MySQL. My current approach involves using the fo ...

Managing Frameset, POST Requests, and Re-Directs like a pro

My current setup involves using FrameSets to split the screen into two sections. The left pane consists of links while the right pane displays actual pages. I am facing an issue with handling entry Forms that are opened on the right pane and submitted. Up ...

Looking to enhance current CSS3 organizational chart by adding a second primary level

I'm having difficulty trying to replicate the first-level (director) box with a vertical line in between. The original chart only has one level with subs below. Take a look at the image provided to see the desired outcome... You can find the CodePen ...

Exploration of jQuery Dropdown Menus

Encountering a problem with my dropdown menu. Check out the code here: http://jsfiddle.net/xY2p6/1/ It seems like a simple issue that I can't figure out, but as shown in the link, the functionality is not working properly. I need help linking the hid ...

Javascript problem: Trouble with event.clientX position

I found a great resource on learning javascript at this website, I'm having trouble understanding the code snippets in function XY(e, v), specifically these two lines: event.clientX + document.documentElement.scrollLeft and event.clientY + document ...

When attempting to read text from an HTML file, JTextPane fails to include a newline character in the output

I am currently working on a project that involves extracting text from an HTML file based on the element's id and displaying it in a JTextPane. However, I am facing an issue where the displayed text does not go to a new line. Here is a snippet of the ...

Adding hyperlinks that do not redirect

I have 2 separate divs displayed on a website: <button class="form-control margin btn btn-warning hide_all" id="addLinks">Link Pages</button> <button style="display: none" class="form-control margin btn btn-primary hide_all" id="hideLinks"& ...