Two flex boxes displayed next to each other on the screen

Within the .maroon section, there are two .whitewrap sections. I am puzzled as to why they are not wrapping onto another line and instead displaying side by side. The form should be positioned below the text and graphic with some maroon showing in between. I do not want to add anything in between the .whitewrap sections. Your assistance is appreciated.

.maroon {
  background-color: #663333;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 50px;
  padding-bottom: 50px;
}

.whitewrap {
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.padding {
  padding-top: 50px;
  padding-bottom: 50px;
}

.wh {
  width: 80%;
}

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

.column {
  flex-direction: column;
  flex-basis: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

img {
  width: 100%;
  display: block;
  height: auto;
}

.whitewrap2 {
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}
<section class="maroon">
  <section class="whitewrap wh">
    <div class="row">
      <div class="column borderright"><img src="https://mcusercontent.com/150448d54e332a15d70ff8ba8/images/1f3cbe64-2615-afb7-9979-06694fa51b97.png">
        <p class="text2">Purchase a combination of 1 suit, 1 tie and 1 shirt to receive $100 off your total.<br><br>Sign up for this offer below on the right. </p>
      </div>
      <div class="column">
        <img src="https://mcusercontent.com/150448d54e332a15d70ff8ba8/images/ab2884f4-5505-0c93-941c-bb177eeab689.png">
      </div>
    </div>
  </section>

  <section class="whitewrap2 wh padding">
    <form action="https://facebook.us7.list-manage.com/subscribe/post?u=150448d54e332a15d70ff8ba8&amp;id=a626d63797&amp;f_id=0054d2e1f0" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank">
      <label for="mce-EMAIL">Email Address <span class="asterisk">*</span><br></label><input type="email" name="EMAIL" class="required email" id="mce-EMAIL" required="" value=""><br><label for="mce-FNAME">First Name </label><br><input type="text" name="FNAME"
        class=" text" id="mce-FNAME" value=""><br><label for="mce-LNAME">Last Name </label><br><input type="text" name="LNAME" class=" text" id="mce-LNAME" value="">
      <br> <input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" value="Sign Up">
    </form>
  </section>
</section>

Answer №1

To resolve the issue, make sure to include either display: block; or flex-direction: column in the parent container that holds the 2 forms.

Your updated code should look like this:

.maroon {
  background-color: #663333;
  display: block;
  align-items: center;
  justify-content: center;
  padding-top: 50px;
  padding-bottom: 50px;
}

.whitewrap {
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.padding {
  padding-top: 50px;
  padding-bottom: 50px;
}

.wh {
  width: 80%;
}
<section class="maroon">
  <section class="whitewrap wh">

    <div class="row">
      <div class="column borderright"><img src="https://mcusercontent.com/150448d54e332a15d70ff8ba8/images/1f3cbe64-2615-afb7-9979-06694fa51b97.png">
        <p class="text2">Purchase a combination of 1 suit, 1 tie and 1 shirt to recieve $100 off your total.<br><br>Sign up for this offer below on the right. </p>
      </div>
      <div class="column">
        <img src="https://mcusercontent.com/150448d54e332a15d70ff8ba8/images/ab2884f4-5505-0c93-941c-bb177eeab689.png">

      </div>

    </div>


  </section>

  <section class="whitewrap2 wh padding">

    <form action="https://facebook.us7.list-manage.com/subscribe/post?u=150448d54e332a15d70ff8ba8&amp;id=a626d63797&amp;f_id=0054d2e1f0" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank">


      <label for="mce-EMAIL">Email Address <span class="asterisk">*</span><br></label><input type="email" name="EMAIL" class="required email" id="mce-EMAIL" required="" value=""><br><label for="mce-FNAME">First Name </label><br><input type="text" name="FNAME"
        class=" text" id="mce-FNAME" value=""><br><label for="mce-LNAME">Last Name </label><br><input type="text" name="LNAME" class="text" id="mce-LNAME" value="">

      <br> <input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" value="Sign Up">

    </form>

  </section>
</section>

Answer №2

It's common for child elements to be arranged in a row by default when using display: flex;. To stack the children on top of each other, simply apply flex-direction: column; to the parent element with the class .maroon

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

On the second attempt, Firefox is able to drag the div element smoothly by itself

I have created a slider resembling volume controls for players using jQuery. However, I am facing an issue ONLY IN FIREFOX. When I drag the slider for the second time, the browser itself drags the div as if dragging images. The problem disappears if I clic ...

Conceal the overflow from absolutely positioned elements

I've gone through all the similar examples but still struggling to find the correct solution. My issue involves a basic Side Menu that toggles upon button click. Within the menu, there is a list of checkboxes positioned absolutely with the parent con ...

Mobile-responsive website design with spacious margins and prominent fonts showcased on visual design mockups

Working on a project where the font-size ranges from 25px to 80px and the margins seem excessively large. Upon testing the layout in the Chrome mobile emulator, the fonts appear unusually large. Is there a specific reason for using such large font values ...

How to Customize the Size and Color of secureTextEntry Inputs in React Native

When it comes to styling a password input like the one below: <TextInput name="Password" type="password" mode="outline" secureTextEntry={true} style={styles.inputStyle} autoCapitalize="none" autoFocus={true} /> I also ap ...

Retrieving a boolean value (from a JSON file) to display as a checkbox using a script

Currently, I am utilizing a script to fetch data from a Google Sheet $.getJSON("https://spreadsheets.google.com/feeds/list/1nPL4wFITrwgz2_alxLnO9VBhJQ7QHuif9nFXurgdSUk/1/public/values?alt=json", function(data) { var sheetData = data.feed.entry; va ...

Unable to initialize styles in a newly created Angular CLI project

Just finished setting up a new project with the angular cli. Encountering an issue when trying to link the styles.css file in index.html <link rel="stylesheet" type="text/css" href="styles.css"> Getting the following error in Chrome's dev too ...

Guide on aligning text below an image at the same height through flexbox styling

I am trying to use flexbox to make two images side by side have the same height and align the text under the image. Can anyone assist me with this issue? Here is the code I am currently using: .row{ display:flex; } .cell img{ width:150px ...

Using the jquery stop() function will halt any ongoing hover effects from being applied

I am currently experiencing a problem with the code found on http://jsfiddle.net/eSbps/. This specific code pertains to a menu system that reveals second levels when hovering over the top levels, using slideDown('slow'). To prevent queuing effe ...

The issue of multiple columns not displaying correctly when set to a height of 100

I am struggling with a seemingly simple task. I want to create two columns on my page, each with a width of 50% and a height of 100% so they completely fill the screen side by side. However, no matter what I try, they do not align properly and end up float ...

Resetting initial values with Velocity.js post-animation

After animating elements into view on a page, I want to defer further animation through CSS classes. However, Velocity keeps all animated properties in the style= tag, hindering CSS transitions. My solution involves resetting the CSS upon completion, but ...

Tips for showing placeholder text on Safari

I'm having an issue with the placeholder attribute in Safari. It seems to be working fine in all other browsers, but not in Safari. <textarea class="concerncommentArea" placeholder="Place your comment here"></textarea> Does anyone know h ...

"Is it possible to create a single-page website with a unique logo for each div

Is it possible to have a unique logo on each section of my single-page website? Each section has its own div. Check out my website at . Thank you in advance! ...

Retrieve the window.selection() range of a content-editable paragraph, taking into consideration any spans within the paragraph's length

When I click on the plain paragraph text, everything seems to work fine. I can determine the start and end of the selected range without any issues. However, when there is a span element with some styling inside the paragraph text, the end of the range is ...

What is the best way to incorporate these elements into my Bootstrap 5 navbar design?

This is the current layout of my navbar, with the logo in the center. I now want to enhance it by adding a search bar and some icons similar to this example: ideal navbar Here is my current navbar for reference: My current navbar <header> <n ...

The querySelector function seems to be identifying the element with the ID "submit" and another input element of type "submit"

My code includes a function that toggles between two elements' style.display values, switching them from "none" to "block" and vice versa. However, I've encountered an unexpected issue where the behavior of the "send" button seems to be linked wi ...

"Angular Ionic combination for displaying lists with customized headers and footers on cards

My issue is fairly straightforward - I am looking to create a list card with item array from my controller. However, I am struggling with how to structure my data in the HTML. The list card should have a header, content, and footer. I have attempted variou ...

Guide to retrieving a user's current address in JSON format using Google API Key integrated into a CDN link

Setting the user's current location on my website has been a challenge. Using Java Script to obtain the geographical coordinates (longitude and latitude) was successful, but converting them into an address format proved tricky. My solution involved le ...

Position an element with absolute positioning to the right edge of a relative element

I have a situation where I need to align the end of a position absolute element with the end of a relative element, but the relative element's width is not fixed and may vary based on content. https://i.sstatic.net/L2sLP.jpg This scenario arises as ...

Compiling 'react-scripts' to include a few images as data URIs within the CSS file

I have recently inherited a sizable React project, even though my experience with React is limited. Nonetheless, I am attempting to make improvements in areas where I feel confident. An ongoing issue we are facing is the excessive size of our main CSS fil ...

Populate the row with an image while maintaining its size

I have encountered an issue with containing images within a Bootstrap row. When I insert an image, it does not stay contained within the row and instead overflows causing scrollbars to appear. My goal is to have the image fit seamlessly into the container ...