When the browser is resized, the third element will automatically wrap to the next line

After working on the code I previously shared, I managed to fix it so that it functions as intended. However, there is a persistent issue where the third element in the row wraps to the next line when the browser width falls between 992px and 1350px. Despite trying various methods such as display: inline-block, floats, flexbox, and more within the CSS media queries, nothing seems to resolve this problem.

CSS

/* CSS styles go here */

html:

<!DOCTYPE html>
<html lang="en">
.
.
.
.
</section>

</body>
</html>

Answer №1

Your code structure could be improved by following a more organized layout. I recommend exploring resources like w3 to learn about float, clearfix, or flexbox layouts before proceeding further with your coding.

Here's a simple vanilla method to display three columns in a row. You can incorporate media queries to ensure the sections resize properly.

Your CSS seems to be extensive and includes Bootstrap classes without having it imported. It appears that your CSS is interacting strangely with these classes. It's quite puzzling! Hopefully, this guidance helps clarify things for you!

.clearfix:after {
     visibility: hidden;
     display: block;
     font-size: 0;
     content: " ";
     clear: both;
     height: 0;
}
.clearfix { display: inline-block; }

section {
  width:31.33%;
  float:left;
  margin-right:1%;
}

<body>
 <header>
    <h1>Our menu</h1>
  </header>
  <div class="clearfix">
    <section class="1">
      <h2 class="loremab1">lorem 1</h2>
      <p class="p1">Lorem ipsum dolor sit amet... (content continues) ...anim id est laborum.
      </p>
    </section>
    <section class="2">
      <h2 class="loremab2">lorem 2</h2>
      <p class="p2">Lorem ipsum dolor sit amet... (content continues) ...anim id est laborum.
      </p>
    </section>
    <section class="3">
      <h2 class="loremab3">lorem 3</h2>
      <p class="p3">Lorem ipsum dolor sit amet... (content continues) ...anim id est laborum.
      </p>
    </section>
  </div>
</body>

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

What is the best way to set up unique body backgrounds for each page in WordPress?

My website consists of various pages named as : page-X.php page-Y.php page-Z.php These three pages mentioned above require unique background colors. However, the remaining pages/posts on my site inherit their background-color from the style.css file. ...

Click to Rotate the Shape

I am attempting to apply a rotation effect on a shape when clicked using jQuery and CSS. My goal is to select the element with the id of x and toggle the class rotate on and off. The rotate class utilizes the CSS transform property to achieve the desired r ...

"Exploring the world of Reactstrap: A

I am struggling to understand the documentation for Bootstrap and reactstrap as I have never used them before. For example, changing the Navbar color and background opacity has been a challenge because they require reserved keywords to be passed as props, ...

Using TailwindCSS with Vite in a vanilla JavaScript project: A step-by-step guide

As a beginner, I feel like I'm losing my mind trying to figure this out. I've watched countless tutorials and read through numerous documents, but still can't seem to get it working. Does anyone have any advice on how to successfully integra ...

Safari: The onbeforeunload event

Welcome! To experience the Leave | Stay confirmation box on your page, please make sure you are using Safari 10. I am currently facing an issue with getting the confirmation box to display properly across different browsers. To begin, please visit and l ...

Adjust the style of cursor - User Interface Expansion Panel Material Design

Using the MiU component "Expansion panel", I encountered an issue. By default, when the user hovers over the panel, the cursor is set to pointer. I attempted to change it to a default cursor, but my modification did not work. The code for my component is ...

Tips for fixed positioning of a div on a webpage without being affected by the Windows logo shortcut keys + Left/Right arrow

Whenever I utilize the keyboard shortcuts to move a window from one side of the screen to another and then minimize it either upwards or downwards, I find myself faced with an issue. I can accomplish this action by using the Windows key in combination with ...

Is it possible for an HTML5 application to download HTML files and save them on a local device?

Can files be downloaded from a server and saved in the same location on disk as the downloading HTML file? This functionality is required for an app that serves as a database of HTML files, with periodic updates. The goal is to prompt users for updates an ...

Is it possible for a web server to transmit information without being prompted by the client?

I'm looking to create a web application for a tool that can run anywhere from a minute to a couple of hours. I want users to be able to initiate the tool's run directly from the webpage, and receive real-time status updates as the process progres ...

Issues occur when attempting to save comments from the frontend in a Django environment

Hey there, I'm having some trouble with comments on my website. When using Class Based Views (CBV), the form is not saving the comments. Below is the code snippet from my models.py: class Product(models.Model): title = models.CharField(ma ...

Placing a FontAwesome icon alongside the navigation bar on the same line

Upon login, the navigation bar experiences display issues. Prior to logging in: https://i.stack.imgur.com/ZKyGe.jpg Following successful login: https://i.stack.imgur.com/zyP3m.jpg An obstacle I'm facing involves the Log Out fontawesome icon wrappi ...

Is there a way to reference an image in the ROOT/app/assets/images directory prior to precompilation?

My current challenge involves using HTML to display an image before the asset precompilation process, which usually moves all images into the public folder. Whenever I use this code: <img src="Flower.jpg">, it points to the path: <RAILS ROOT>/ ...

NodeJS File Upload: A Step-by-Step Guide

I need assistance with uploading an image using nodejs. I am able to successfully send the file to node, but I am unsure how to handle the "req" object. Client <html> <body> <input id="uploadInput" type="file"/> < ...

Include a back button during the loading of a URL in an Electron application

Within my Electron application, I have implemented elements that, upon clicking, redirect to a URL. However, navigating back to the previous (local) page is not currently achievable. Is there a feasible method to incorporate a layered back button on top o ...

How to implement a delay for submenu dropdown in Bootstrap 3

I am trying to implement a delay on a submenu that I have created, rather than the entire bootstrap3 dropdown menu. The goal is to allow users to easily move their cursor to the submenu without it closing unexpectedly. Although the jquery code should still ...

The issue of PHP timing out occurring within a public function

After pulling a "large" SQL query from the database with 50,000 records and completing it in about 5 seconds, I run it through a function to create an HTML table. However, the process keeps timing out for some reason. If I limit the query to less than 30k ...

The custom font integrated into the website is not showing up properly in Internet Explorer or Google Chrome

I've set up the following font configuration in the CSS for a WordPress-based website I'm creating. The fonts appear correctly in Firefox, but do not show up at all in Internet Explorer (9) or the latest version of Chrome. /* =Typography --- ...

Is there a method in JS/jQuery to fill my input field with a constant string and ensure leading zeros are included?

I am looking to create an input textbox that starts with a fixed string followed by up to 6 leading zeros. As the user types in the input box, the leading zeros will be automatically removed once the maximum length of 6 characters is reached. The initial s ...

Position two elements side by side without utilizing the float property

<html> <head> <style> #success { color: #f0f0f0; position: relative; top: 3%; left: 50%; padding: 0; margin: 0; } #errors { color: #b81d18; ...

Link causing chaos in CSS animation

I've created a CSS animated banner. You can view the result here. However, I'm facing an issue where adding a hyperlink to some of the pictures is causing the animation to mess up. The first picture has a href attribute, making it smaller and not ...