Challenges with CSS floating and centering in responsive design

My footer consists of 3 elements structured in the following way:

 <div class="footer">
   <div class ="jumperMenu">
     <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
     </ul>
   </div>
   <div class ="logo">
        <a href="#"><img src="#"/></a>
   </div>
   <div class ="navJumpMenu">
     <ul>
        <li>Page1</li>
        <li>Page2</li>
        <li>Page3</li>
     </ul>
   </div>

To adjust to different screen sizes, the footer div needs a maximum width of 1600px. The JumperMenu must stick to the left, the logo centered, and the navJumpMenu stuck to the right with 10px padding on each side. While floats work fine for this layout, I encounter an issue when needing all elements to adapt their positions on smaller screens (e.g., 1200px) and maintain their respective layouts without using jQuery positioning. Does anyone have suggestions on how to achieve this responsive design using pure CSS? Thank you!

Answer №1

Check out this code on JSFiddle

.footer{max-width:1600px; margin:0 auto;text-align:center;}
.jumperMenu{float:left;}
.navJumpMenu{float:right;}
.logo{margin:0 auto;}​

In order to prevent the elements from overlapping, you may want to consider setting a minimum width for the footer container. Is this what you were looking for?

Answer №2

Does this meet your needs?

.header {
display: block;
max-width: 1200px;
min-width: <your minimum width>;
text-align: center;
}
.header>* {display: block;text-align: left;}
.header #navMenu{float:right;}
.header #menuLink{float:left;}

I trust that this information is useful for you.

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

Avoid stretching the div to the edge of the screen

In the table on my page, I have implemented a feature using CSS to display additional information in a popup div. This works well when there is limited text, but if there is extensive text in the table, it extends beyond the screen width and becomes diffic ...

Show jQuery block and make it fade in

I'm attempting to put together a simple tab system where each tab is supposed to appear using a fadeIn effect. In the code below, the .field element is initially hidden with CSS. Although the tabs are displayed correctly, the desired fadeIn effect is ...

Making adjustments to text in HTML without altering the CSS or styling is proving to be challenging

When attempting to modify a h1 tag without changing the CSS, I encountered an issue. Below is the string with and without the JavaScript: String without JavaScript: https://i.sstatic.net/JWOmq.png String with JavaScript: https://i.sstatic.net/RNMur.png ...

Determine the time variance in hours and minutes by utilizing the keyup event in either javascript or jquery

There are 6 input fields, with 5 input boxes designated for time and the result expected to display in the 6th input box. See the HTML below: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input ty ...

Loading Animation for Pages and Tables

I'm experiencing a choppy and sudden transition when switching between two pages that contain tables populated using ng-repeat. Upon loading, the footer is positioned halfway up the page below the table heading until the table loads and the layout adj ...

Centering input boxes within a panel body through the implementation of CSS grid technology

I am facing an issue with implementing a form input box inside a panel body using CSS grid layout. The input box seems to overflow outside the panel body, which is not the desired behavior. Strangely, the code works fine with regular CSS, but I prefer usin ...

Draggable Table Columns with HTML, CSS, and JavaScript

My goal is to create a table in a JSP page that functions similarly to the example shown here. I would like to be able to drag a column of dates within the table and have a form pop up. Can anyone provide guidance on how I can achieve this in JSP? ...

Why isn't the document.getElementById().value() function functioning properly within my PHP code?

When working on my PHP code, I included the following: <select class="ht__select" onchange="sorting('<?php echo $id ?>')" id="sorting"> <option value="">Default sorting</option> <option value="low_price">Sor ...

Clean up your CSS code in Firefox 10.0.X with this amazing cleaner

Searching for a tool to clean up CSS in Firefox 10.0.x similar to Dust-Me Selectors. Unfortunately, Dust-Me Selectors is currently not supported in Firefox 10.0.x. Any recommendations for an online tool to identify unused CSS selectors? ...

What is the best way to arrange <div> elements with text inside without moving the text?

I need help figuring out how to stack one or more <div> elements on top of another <div> element while maintaining the text content within each. My issue is illustrated in this fiddle: https://jsfiddle.net/rd268ucy/1/. When attempting to drag o ...

Bootstrap 4 collapsible navbar with a stacked design

I am struggling to create a collapsible navbar. Even though everything seems to be working, the nav items are not stacking vertically as they should be. Instead, they are appearing horizontally next to each other. Here is the code snippet: <nav class= ...

Extract a CSS property and store it in a variable using JQuery

Is there a way to extract a CSS value from a specific class on a webpage and then use it for styling other elements in different ways? I created an example on jsfiddle where I want to retrieve the background color from .box and save it to a variable nam ...

Media queries for min-width and max-width are being disregarded in inline CSS styling

I am currently designing a pricing page for my Django application, featuring three columns. The intended design is to display all three columns side-by-side when the screen size is more than 768 pixels, and switch to a single column layout with pricing opt ...

Tips on activating the CSS style while typing using the onChange event in React

Is it possible to dynamically adjust the width of an input as we type in React? Currently, my input has a default width of 1ch. I would like it to increase or decrease based on the number of characters entered, so that the percentage sign stays at the end ...

Various designs for various arrangements in vuejs applications

In my project, I have two distinct layouts that function as separate parent routes with multiple nested components. I want to apply different global styles to each layout, but when I import styles for one layout, it affects the other as well: <style ty ...

Enable and disable modal popup functionality in ng-bootstrap for Angular 5

How do I enable (editable) and disable (not editable) an ng-bootstrap modal popup? I have the following HTML code to display a modal popup when a button is clicked. However, I want it to be inactive until a certain condition is met. I am unsure of how to ...

Having trouble with named anchor link not functioning in Internet Explorer. I have attempted the recommended fixes from Stack Overflow with no

My issue involves using a named anchor tag: <table id="search_results" name="search_results"> When I try to link to it like this: pagename.php#search_results It works in Firefox and Chrome, but not in IE (8). I have explored using an <a> t ...

What is the functionality of the icon `<i>` in Twitter Bootstrap?

After adding an icon to a webpage, I noticed that it replaced the old, semi-deprecated <i> tag and instead used a customized image tag. It almost seems like <i ...> is just a simpler version of <img ...>. I'm curious about how this ...

I am looking for guidance on the proper way to import MatDrawer and MatDrawerContainer in the app.module.ts file for an Angular

When attempting to implement a side nav using angular material and clicking on the toolbar icon, everything was functioning correctly until I encountered an error while trying to open the navbar: The error message displayed: Unexpected directive 'Ma ...

Expanding Side Panel feature in Bootstrap 4+

Attempting to create a collapsible sidebar using Bootstrap 4+. I managed to find code for Bootstrap 3.7.3 from here, but after converting it to Bootstrap 4+, the layout doesn't appear as intended. I'm not well-versed in HTML styling and would gre ...