Ensure that two divs are aligned on the same line when the screen size is 768px or smaller

I have a footer container with menu items and paddles for scrolling. The layout includes a description text and a log link.

When the screen size is over 768px, all three elements (menu, description text, log link) are displayed in the same line. However, if the screen size is less than 768px, the design should look like this:

< Menu >
Description text     Log link

Check out the screenshot for screens less than 768px: https://i.sstatic.net/33QZI.png

The issue arises when the description text and log link are not on the same line due to the width of the log section, causing the menu inner wrapper to be hidden behind the screen. How can this be resolved?

Below is my CSS style for screens less than 768px:

@media only screen and (min-width: 414px)  and (max-width: 767px) {
  .footerContainer {
    height: 72px;
    flex-direction: column;
    .menu_item_outer_wrapper {
      width: 390px !important;
      height: 100%;
      .paddles {
        display: block;
        .left-paddle {
          transform: translate(-1%, -45%);
        }
        .right-paddle {
          right:0;
          transform: translate(10%, -45%);
        }
      }
      .menu_item_inner_wrapper {
        margin-left: 36px;
      }
    }
    .footer-desc_log-section {
      width: 100%;
      .footer__description {
        width: 60%;
        margin-left: 8px;
      }
      .footer__description,
      .footer__audit-log {
        line-height: 32px;
      }
    }
    .footer-desc_log-section {
      width: 100% !important;
      height: 100%;
    }
  }
}

Answer №1

@media only screen and (max-width: 768px) {
  /* For mobile phones: */
  div{
    display:inline;
  }
}
.div2{
  float:right;
}
<body>
  <div class="div1">Div 1</div>
  <div class="div2">Div 2</div>
<body/>

If you want to see how this code works, simply include display:inline; in the CSS of the div element.

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

Creating interactive HTML cards by dynamically generating them from a Javascript array and Bootstrap, organizing them into distinct rows and columns

I need assistance in structuring my Team section with multiple rows, each containing 5 cards. I have a list of team members that I want to display in this format using a single array and loop. However, I am struggling to figure out how to automatically cre ...

apply styling to the placeholder with CSS

I have been attempting to customize the styling of the placeholder text. After setting the color to red within the input class, I did not see any changes. Even after conducting research and referring to this link Styling the placeholder in a TextField, I w ...

Is the font-weight feature malfunctioning on Firefox?

I ran into an issue while dynamically generating div elements where certain style properties were not working properly in Firefox. $(".contacttiles").eq(i).append("<div id=mm"+i+"' class=exp style='font-weight:bold;font-size:14px;color:#FFFFF ...

Tips for choosing options from interactive drop-down menus with watir

Seeking to streamline the login process, I am looking to automate the generation of a list of databases using specified username and password credentials. I attempted the following approach: Browser.text_field(:id,"comboDatabase").when_present.set "(tas01 ...

Creating a column in CSS that maximizes width without utilizing 100% or causing text wrap

Trying to keep a three-column div from spilling over the page can be tricky. The first two columns must not exceed 200px, while the third column should be at least 280px wide. The issue arises when there is a table in the third column with long sentences i ...

What is the best way to update JSON data using JQuery?

I apologize for posing a seemingly simple query, but my understanding of JavaScript and JQuery is still in its early stages. The predicament I currently face involves retrieving JSON data from an external server where the information undergoes frequent ch ...

Determine the closest multiple of 50000 by rounding down the number within the designated input

My input range is behaving strangely. The value starts at 0, but it jumps all the way to 40000 in one direction and -10000 in the other direction. I want it to jump by increments of 50000 - the step indicator is already set to 50000. I believe this issue i ...

I'm looking to use JavaScript to dynamically generate multiple tabs based on the selected option in a dropdown menu

I'm reaching out with this question because my search for a clear answer or method has come up empty. Here's what I need help with: I've set up a dropdown titled 'Number of Chassis'. Depending on the selection made in this dropdown ...

Utilizing JavaScript to dynamically set a CSS file from an API in AngularJS

I am currently facing an issue with integrating a CSS file returned by an API into my entire website. Since the URL of the CSS file keeps changing, hard coding the URL is not feasible. While I have successfully implemented this on 'view1', my goa ...

Dynamically insert ID into a div element

Hi there, I have an ID "network" in the div class "parent". Inside this parent div, there is a for loop that generates multiple IPs. Whenever I click on a specific parent IP, it should call its child div. How can I dynamically generate IDs so that I can pl ...

get an html hyperlink to download excel

I am attempting to download the excel file from my angular application, and in order to do so I have set up a subfolder named Files <p><a href="/Files/MyList.xlsx" download target="_self"> Click here to Download </a>&l ...

The close button on the modal vanishes on a real iPhone

The issue I am facing is that the Close Button appears when testing responsiveness in Chrome, but disappears on a real iPhone. When clicking on an image, the image gallery should appear. However, on an iPhone, only the previous and next buttons are visibl ...

The footer that constantly changes

I am looking to dynamically position my footer at the bottom of the page. The footer should be fixed at the bottom. If the page content exceeds the viewport, the footer should automatically adjust its position. html { position: relative; m ...

Circle a component around another on the vertical axis (z-index)

A plugin caught my eye some time back, but I'm having trouble locating it. This nifty tool operates by positioning an element behind another one, then smoothly sliding it to the right. After that, it changes the z-index so the element appears larger i ...

How should HTML5 type "month" be stored in a Django model's database using which data type?

My HTML form includes a field for inputting a month <input type='month' name="last_appraisal" id='txtLastAppraisal' value='2013-12' /> In the Django model, I have defined this field as last_appraisal = models.DateFie ...

Deleting a li element within an AJAX response function can be accomplished by targeting the specific

I am attempting to remove the li element that is the parent of the clicked a element. Here is the code I am using: function vanish(id_arg){ $.ajax({ url: "/vanish/", type: "POST", data: {id_to_delete: id_arg}, ...

Is there a way for me to position my emoji directly alongside the title text?

I'm facing a challenge with aligning my image right next to the heading. Specifically, I want it to be placed next to "Sample Text". Currently, the container that includes the heading and emoji is set as a flexbox. .container{ display:flex; ...

Tips on maintaining the initial section of collapsible div open in AngularJS

I have a collapsible section in my AngularJS application that can be expanded by default using a JSON array in the script.js file. However, I am looking for a different way to keep it open without relying on JSON data. Below is the sample code: https://p ...

In CodeIgniter, the $this->input->post() function consistently returns an empty value

I'm encountering an issue where the value from an AJAX post always turns out empty. Even after confirming that the value is correct before the post, I'm unable to retrieve it using $this->input->post() HTML <?php if ($product_info-> ...

Why isn't my dropdown menu appearing correctly?

After trying numerous approaches, I am still struggling to create a drop-down menu from an image. The cursor does change to a pointer, but something is clearly not right. Here are the HTML and CSS snippets I am currently working with: <a> <im ...