The section cannot be shown in a flex layout within a grid container

My goal is to showcase a grid layout containing multiple sections within a div, but I'm encountering an issue where the sections are only displaying as blocks. I am seeking assistance in making the second portion of the data appear flexed. Currently, when attempting to set the Class locationInfo div to display flex, it doesn't have any effect.

I would like the layout to resemble this: https://i.sstatic.net/XrPi8.png

However, at present, it looks like this: https://i.sstatic.net/SfaAL.png

Below is the code snippet for my component:

<template>
  <div id="mainDiv">

        <div id="locationInfo">
               <!-- left detail section -->
            
                  <div>
                    <section>
                    <p><b>NYC</b></p>
                    <small>7:35</small>
                    </section>
                  
                  <section>
                    <img src='../assets/svg/flight.svg' height="40px" width="40px"/>
                    <small>10/12/20</small>
                    </section>
                
                <section>
                    <p><b>SYD</b></p>
                    <small>10:45</small>
                  </section>

                      <div id="AirlinesDetails">
               <img src="../assets/svg/home/logo-2.svg" height="40px" width="40px" />
                  <section>
                    <b><p>Turkish Airlines</p></b>
                    <small>cx511 | Airbus 333</small>
                  </section>
                  <section>
                    <p>2 Stop</p>
                    <small>3h 58min</small>
                  </section>
                </div> 

             </div>
        



        <!-- second row-->
                  <div>
                    <section>
                      <h4>NYC</h4>
                      <small>7:35</small>
                    </section>

                    <section>
                      <img src='../assets/svg/flight.svg' height="40px" width="40px"/>
                      <small>10/19/20</small>
                    </section>
                 
                    <section>
                    <h4>SYD</h4>
                    <small>10:35</small>
                    </section>

                        <div id="AirlinesDetails">
               <img src="../assets/svg/home/logo-2.svg" height="40px" width="40px" />
                  <section>
                    <b><p>Turkish Airlines</p></b>
                    <small>cx511 | Airbus 333</small>
                  </section>
                  <section>
                    <p>2 Stop</p>
                    <small>3h 58min</small>
                  </section>
                </div>
                
              </div>
              </div>
        
       

        </div>
    
  </div>
</template>


<style scoped>
#modal-1{
  border: none;
...

Answer №1

Check out this potential solution using flexbox and see if it suits your needs.

 <div class="flight-container">
      <section class="flight">
        <div class="flight-info">
          <div>
            <h4>NYC</h4>
            <p><small>7:35</small><p>
          </div>
          <div>
          <img src='../assets/svg/flight.svg' height="40px" width="40px"/>
          <p><small>10/19/20</small></p>
        </div>
          <div>
          <h4>SYD</h4>
          <p><small>10:35</small></p>
        </div>
        </div>
        <div class="flight-info">
          <div>
            <div class="row">
              <div>
                <img src="../assets/svg/home/logo-2.svg" height="40px" width="40px" />
              </div>
              <div>
                <strong>Turkish Airlines</strong></b>
                <p><small>cx511 | Airbus 333</small><p>
              </div>
            </div>
          </div>
          <div>
            <h4>2 Stop</h4>
            <p><small>3h 58min</small></p>
          </div>
        </div>
      </section>
      <section class="flight">.....</section>
    </div>

CSS

.flight-container{
  display: flex;
}
.flight{
  width: 50%;
}
.flight-info{
  display: flex;
  justify-content: space-between;
}
.row{
  display:flex;
}

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

Timer countdown: Looking for a countdown timer that will reset to 3:00 automatically each time it reaches 0 minutes, and can do so

Seeking a continuous countdown timer that starts from 03:00 and counts down to 0:00, then automatically resets back to 03:00, in an infinite loop. The condition is that no one should be able to manually stop this logic. After researching, I found a Ja ...

Condition has been fulfilled for both ngShow and ngHide

I am attempting to show a loading icon while data is being loaded, and then display the data once it is ready. However, I am encountering a problem where for a brief moment, both the loading icon and the data are visible... Below is my code snippet: $scop ...

Discovering visible ID numbers on the screen

My content includes the following: <div id="sContainer"> <div class="message0" id="l0">Initial Content 111</div> <div class="message1" id="l1">Initial Content 222</div> <div class="message2" id="l2">Initial ...

Angular does not display a loading indicator in the header

When handling service calls, I have implemented a loading indicator to provide feedback to the user. However, it appears that this indicator is not effectively preventing users from interacting with header items before the loading process is complete. My ...

The powers of jQuery and CSS selectors

Previously, I utilized the following code to extract text from the data-placeholder attribute and apply it as a placeholder for my div. [contentEditable=true]:empty:not(:focus):before { content:attr(data-placeholder) } While this method worked well b ...

Show flexibility in the grandchildren of a row layout

My goal is to achieve a layout similar to the image below using the flex "system", but I am facing a challenge with some generated directives that are inserted between my layout div and the flex containers: <div id="i-can-control-this-div" layout="ro ...

Exploring the world of JQuery Ajax selectors

I am attempting to create a comment system similar to the one found at . I have the AJAX code below, but I am having trouble uniquely selecting text areas for each post. The issue is that the number of posts can vary, so it's important that each post ...

Mobile devices cause CSS drop shadows to malfunction | Next.js

Update: After some testing, I discovered that this issue is specific to iPhones. When I tested it with an android device, everything worked perfectly fine. However, when I tried viewing the page on two different iPhones, it broke on both. This problem see ...

Vue.js blocks the use of iframes

I've come across a peculiar issue where I need to embed an iframe inside a Vue template and then be able to modify that iframe later. The code snippet below shows the simplified version of the problem: <html> <body> <div id="app" ...

Press anywhere outside the container to conceal it along with the button

Utilizing an Angular directive to hide div elements when the user interacts outside of them has been effective. However, there is a specific issue that arises when clicking outside of a div on a button that toggles the visibility of the div. The 'ang ...

Navigating through child elements within a div using JavaScript

I recently coded a div using this snippet... let sidebarBox = document.createElement("div"); sidebarBox.id = "sidebarBox"; ...and then I created a second div like so... let sidebarAd = document.createElement("div"); sidebarAd.className = "sidebarAd"; B ...

Vibrant shades of color overflow the Mui Radio

For my current web project, I am utilizing Mui for styling purposes. I am seeking guidance on how to style a radio button in a way that it appears completely filled with one color when selected. It is important that this styling method is compatible with M ...

Is there a way to reset my div back to its initial background color when clicked a second time?

I am currently utilizing the jQuery addClass and removeClass animate feature for my project. Basically, what is happening is that when the user clicks on a particular link, a dropdown navigation will appear. This feature is essential for ensuring responsi ...

Problem encountered in Vue.js web application when running NPM, resulting in Error 126

When attempting to compile my Vue.js application using the command npm run prod, I encountered the following error: sh: /Users/antoinevandenheste/Downloads/magicfactory-1/node_modules/.bin/webpack: Permission denied npm ERR! code ELIFECYCLE npm ERR! errno ...

Optimal method for storing large arrays of numbers in localStorage using JavaScript

*"Efficient" in this context refers to smaller size (to reduce IO waiting time) and fast retrieval/deserialization times. Storing times are less important in this scenario. I need to store multiple arrays of integers in the browser's localStorage, ea ...

The CSS Specificity Hierarchy

I am currently facing a dilemma with two CSS classes in my codebase. Despite having a stronger specificity, the second class is not being chosen over the first one. Can anyone shed some light on this issue? The CSS class that is currently being applied is ...

Use the powerful $.post() method to transfer an image to another page seamlessly

I have two pages, the first page contains a form where users can enter information such as name and mobile number. Additionally, they can upload an image. I would like to use jQuery to access the uploaded image and send it to another page using the $.post( ...

"Enhancing Filter Functionality in Vue.js 2.0 with Multiple Category

I am currently trying to implement multi-category filtering using vuejs 2. However, I have been facing difficulties with the filtering process not functioning as expected. Although I am familiar with performing filtering operations using the computed meth ...

The value returned by $(this).next() is undefined

I'm struggling to implement jQuery functionality to toggle the display of a div, but I am encountering an issue where my jQuery code is unable to select it. Every time I try, it returns undefined. Can anyone provide assistance? $(document).on(&apos ...

When utilizing Vue.js, I aim to eliminate a <td></td> element as the colspan data increases

After playing around with vuejs for a few weeks, I am facing an issue. I want to dynamically remove a td tag every time the colspan value exceeds the default one. For example, if the initial colspan is 3 and it changes to 4, I need to remove one td tag. So ...