Unable to position divs next to each other in Firefox, yet successfully achieved in Chrome

I have successfully placed two divs side by side using the following markup, as shown in image 1, but this layout only works on Chrome. However, Firefox renders it differently as seen in Image 2. Is this a known issue that I overlooked? How can I resolve this?

<div style="background-color: #ffcc33;">
    <div class="entry-content" style="float: left;">
        <h3>Full Article: <a href = "<?php the_field('url'); ?> "target="_blank">Link</a></h3>
        <div id="summary_headline">
            <h3>Summary</h3>
        </div>
        <?php
            the_field('generated_summary');
            
                           wp_link_pages( array(
                               'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'inbox' ),
                               'after'  => '</div>',
                           ) );
                           ?>
        <p class="read-more"><a href="<?php the_permalink(); ?>" target="_blank" class="button"><?php echo esc_html('Read More', 'inbox'); ?></a></p>
    </div>
    <div style="float: left;  background-color: #eee;">
        <div id="wordmap_display" style="background-color: #a0a0a0;" >
            <h3>Word Map</h3>
            <div id="wordmap_chart"></div>
        </div>
        <div id="sa_results_display" style="background-color: #f5baff;">
            <h3>Sentiment Analysis Results</h3>
            <canvas id="sa_chart"></canvas>
        </div>
        <div style="clear: both;"></div>
    </div>
</div>

CSS

.page .post-content .entry-content, .single-post .post-content .entry-content {
    height: auto;
    overflow: hidden;
    background: #42ffec;
    width: 60%;
}
.post-content .entry-content {
    height: 60vh;
    overflow: hidden;
    position: relative;
    text-align: justify;
}
div {
    display: block;
}

EDIT: I found a solution. By setting the outermost div to overflow: hidden and removing float:left from the second inner div while adding overflow:hidden, I was able to make it work.

Answer №1

To create a flexible layout, utilize the display: flex property which is widely supported by major browsers.

.main-container {
  background-color: #ffcc33;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}

.more-details {
  float: left;  
  background-color: #eee;
}
<div class="main-container">
    <div class="entry-content" style="float: left;">
        <h3>Full Article: <a href = "#" target="_blank">Link</a></h3>
        <div id="summary_headline">
            <h3>Summary</h3>
        </div>
        Dynamic markup from PHP
        <p class="read-more"><a href="#" target="_blank" class="button">Read More</a></p>
    </div>
    <div style="more-details">
        <div id="wordmap_display" style="background-color: #a0a0a0;" >
            <h3>Word Map</h3>
            <div id="wordmap_chart"></div>
        </div>
        <div id="sa_results_display" style="background-color: #f5baff;">
            <h3>Sentiment Analysis Results</h3>
            <canvas id="sa_chart"></canvas>
        </div>
        <div style="clear: both;"></div>
    </div>
</div>

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

Trouble with Excel Office Script setInterval functionality

Trying to automatically recalculate an Excel worksheet every second using Office Script. Unfortunately, my initial approach did not succeed. function sendUpdate(sheet: ExcelScript.Worksheet) { console.log('hi'); sheet.calculate(true); } func ...

Discover the Practical Utility of Maps beyond Hash Tables in Everyday Life

I am currently attempting to explain the concept of Maps (also known as hash tables or dictionaries) to someone who is a beginner in programming. While most people are familiar with the concepts of Arrays (a list of things) and Sets (a bag of things), I ...

The Mongoose model is having issues being imported into a different Component

Attempting to utilize my model for displaying and locating users in MongoDB has hit a snag. Upon importing it into profile.js and launching my app, an error is thrown: Cannot read properties of undefined (reading 'Users') https://i.stack.imgur.c ...

Using Node.js, is there a way to divide an object's array property by 100 and then store each portion in individual files?

Looking to break down a large object into chunks of 100 and save each chunk in separate files using Node.js. However, struggling to figure out how to split an array with thousands of records into files of 100. Query: How can I divide an object's arr ...

Container holding a Material-UI drawer

Is it possible to set the material-ui drawer inside a container in reactjs? I have wrapped my app page in a container with a maximum width of 600px. I want the drawer to start within that container instead of on the body page (picture). The app bar positi ...

Trouble arising from PHP's encoded array

I am encountering an issue with retrieving a value from PHP and passing it to Javascript. The PHP array is encoded like this : echo json_encode($myArray); On the Javascript side, I use the following code within the $.ajax method: success:function (data) ...

The stacking order of a child element within a parent element, which has a transform

Hey there, I've encountered a problem and was wondering if you could assist me with it. In the code snippet provided below, you'll see that there are elements with: transform: translate(0,0); Within these elements, there is a "dropdown" elemen ...

Validating Firebase data for null values

Hey there, I'm currently working on a simple coding project but seems to be encountering some roadblocks. The main objective of the code is to determine if a username exists in the system or not. Here's a snippet of the data structure and codes ...

When attempting to initiate a new session, Webdriver.io receives an HTML response from selenium

Currently, I am attempting to execute my selenium tests using webdriver.io. However, the test runner is encountering failure when attempting to establish a session: [18:12:36] COMMAND POST "/session" [18:12:36] DATA {"desiredCapab ...

Responsive Alignment of Slanted Edges using CSS

I have been working on creating a responsive diagonal layout with slanted shapes (refer to the image attached). However, I'm facing a challenge with aligning the edges smoothly at different screen sizes, especially when the rows grow and the screen re ...

Leveraging React's UseEffect() to retrieve information from GraphQL

I am currently attempting to retrieve data from graphQL. I understand that by placing a function inside the react UseEffect(), I can trigger the function once the data is updated and structured. However, while working on a chatroom feature, I am facing an ...

Is there a way to transform a circular structure into JSON format?

I retrieved data from the database and now I need to format it, but I encountered the following error: TypeError: Converting circular structure to JSON --> starting at object with constructor 'NativeConnection' | property ' ...

The process of altering the color of a table row in JavaScript can be done after dismissing a pop-up that was triggered by a button within the same row

I am tasked with changing the color of a specific table row based on user interaction. The table consists of multiple rows, each containing a button or image. When the user clicks on one of these buttons or images, a popup appears. Upon successful data sub ...

Storing numerous sets of application credentials in Node.js using a specific design pattern

As I develop a node.JS server that communicates with Microsoft APIs, the server manages multiple applications created in Azure, each requiring a configured Client ID and Client secret. I have implemented a strategy to switch between these credentials based ...

In React, components will consistently render the initial code

I have a chat application that requires authentication and uses cookies. Here's what I've been attempting: class AppHeader extends React.Component { constructor(props) { super(props) } render() { if (cookies.get(' ...

I need help figuring out the proper way to establish an indexing path in cosmos db using the nodejs sdk

I'm currently facing a challenge with setting up the indexing policy for one of my cosmosdb containers. Within my cosmosdb, I have a container that stores information about user sessions. Using the node sdk, I am defining the containers, partition key ...

What is the best way to retrieve ul li values using AngularJS?

I am looking to extract the content of li elements within a ul element in an AngularJS controller and save them into an array. Sample HTML Code: <ul id="list" my-directive> <li>A</li> <li>B</li> <li>C ...

Design a Logo-aligned Header using Bootstrap 4 for a professional and sleek look

I'm attempting to design a header using bootstrap 4 that resembles the image shown https://i.sstatic.net/MFVZU.png. However, I'm encountering several issues with this method. The main problem is that the logo is not properly centered in the middl ...

Guidance on implementing fallback font formats using FontFace API

I am exploring the FontFace API (not @fontface) and wondering if there is an easy way to include multiple font formats, similar to providing multiple sources in @fontface. Alternatively, is there a simple method to identify which font formats are supporte ...

Webpack 4 Failing to Properly Render Select Tag

I am encountering an issue with a basic select element that is not displaying correctly due to Webpack. The screenshot below illustrates the final rendered page source, where the closing tag for the select element has been incorrectly positioned before the ...