Problem related to the absolutive position

Is there a way to center the wrapper of the webpage effectively? I am finding it difficult to make it responsive due to the absolute positioning of the ribbon menu. Can you suggest any changes that would help me achieve responsivity?

Check out the live example here: jsFiddle

body
  -nav
     -div.r1
       div.ribbon(...)
     -div.r2
       div.ribbon(...)
     -div.r3
       div.ribbon(...)
     -div.r4
       div.ribbon(...)
     -div.r5
       div.ribbon(...)
  -div.wrapper(...)

Answer №1

It appears that your design is quite intriguing with a variety of numerical elements in play. The default margin on the body, 5em of padding, and positioning the metal box at 11.8% off these values all contribute to the layout. To ensure alignment of the nav element, it's crucial to carefully manage these properties. However, mixing different units can be challenging unless supported by browsers that offer functionalities like calc. Consider trying the following adjustments or simplifying your layout:

body {
    margin:0;
    padding: 5em;
    background: #333;
}
.nav {
    position: relative;
    right: calc(-11.8% + 5em + 7px);
}

For more details and testing, you can refer to the jsfiddle link provided: http://jsfiddle.net/up7HD/6/

It's unclear why you chose 11.8% and 5em for padding, as using ems can lead to inconsistent results across different browsers due to varying font sizes. Additionally, 11.8% may not center the metal box effectively or leave sufficient space for other elements on smaller screens.

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

Is your HTML failing to refresh?

I developed a CGI application in C. When I send a POST request to the cgi app from an HTML form, the action is successfully completed on the server. However, the page does not automatically refresh after the POST. Instead, it flickers but continues to di ...

Eliminate the bold frame surrounding the input textbox

Objective: I want to remove the bold frame around the input textboxes, while maintaining a simple and single frame appearance. Issue: The boldness of the input textbox frame becomes prominent when using CSS code related to background-image, background ...

The issue of background repetition persists exclusively on Chrome, even after implementing the 'no-repeat' property

I'm struggling to figure out why my background keeps repeating in CSS even though I've used the no-repeat property. I want to avoid using the background-cover option as it distorts the image, and this issue seems to be specific to Chrome. Check ...

The storage of HTML5 data is not being saved locally

<html> <head> <title></title> <style type="text/css"> body { font-family: tahoma; } h2 { font-weight: bold; border-bottom: 2px solid gray; margin-bottom: 10px; } #dat ...

How do I get the Bootstrap carousel caption to display in fullscreen mode at 1920 x 1080 resolution?

Currently puzzled by the issue of carousel-caption not displaying in a full-screen 1920x1080 window. When the window is not enlarged, the caption appears as expected. Here's the code causing concern: <div id="carousel-example-generic" class="carou ...

Tips for Creating a CSS Radio Button in ASP.NET

I've recently developed a web application using asp.net and I'm facing an issue while trying to style the radio buttons using CSS like the example below: https://i.sstatic.net/k7qGB.jpg However, after applying this design, the radio buttons are ...

Expanding the Bootstrap 5 accordion causes it to extend beyond the designated width

My initial expectation was for the accordion component to expand to match its parent's width. However, upon expansion, it not only enlarges itself but also causes the parent element to compress significantly. What steps should be taken to achieve the ...

Tips for executing a task continuously for a minimum duration of 3 seconds

As I work on creating a WordPress template, I am trying to incorporate an image display during the page loading process. However, I want this loading period to last a minimum of 3 seconds. Is there a way to specify a function execution time? Currently, I a ...

"Trouble arises when attempting to render a basic Vue.Draggable component within a nested ul

Problem with Nesting After receiving feedback from @Amaarrockz, I attempted to create a sandbox to address the issue I'm facing. However, the problem persists. Here's the code snippet: <div id="app"> <ul> <li ...

Align Horizontal Fixed Element

<html> <head> <style> #rectangle { position: absolute; right: 0; bottom: 0; width: 150px; height: 200px; } </st ...

Trouble centering absolute-positioned text within a div, even after implementing the text-overflow property in CSS

Apologies for returning with another question. I recently included a text-overflow: ellipses attribute to my TextCut div in order to truncate the text, however, it caused the content to no longer be centered. Instead of being positioned at the center as ...

At what precise moment does React apply the CSS to a component?

In my app.js file, I import someComponent.js. This someComponent.js file then imports someStyles.css. However, app.js will only use or render someComponent.js when a button is clicked. So, the question arises: When will the user's browser load and ap ...

Creating a nested link structure that alters its list item background color when another list item is hovered over

Seeking assistance with a jQuery issue - can anyone spare some time to help me out? I am attempting to change the background of a parent element when its child is hovered over, and then revert back to its default when the child's hover ends. The cur ...

Tips for positioning a group of images in the center of their parent container, with hidden overflow and aligning them both to

I have a wrapper containing 50 small images. Currently, the images are displayed horizontally on the same line with hidden overflow, but they start from the left. Is there a way to make the overflow extend both LEFT and RIGHT while positioning the startin ...

Tips for clearing the blue color box from inputs and buttons in bootstrap after they are clicked

How can I get rid of the blue color box that appears when clicking on form elements such as inputs, select, textarea, and buttons? I have tried removing it using CSS but it still persists and is quite annoying. Is there a way to remove this blue box using ...

Resizing a column in the Bootstrap CSS grid causes adjacent columns to move

I am currently working with a bootstrap grid that includes an expand component. The issue I am facing is that when I expand one column, the other columns in the same row also shift. Is there a way to make each column independent of the others? expand co ...

push one element to fit in between two adjacent elements

Is there a way to make my responsive webpage ensure that the full-screen element appears between sibling elements when viewed on mobile devices? Check it out on desktop or on mobile here. I have three (div) elements: two in one row and another in a separa ...

Creative Text Container CSS Styling

Check out this website for the container I want to replicate: container This is the specific textbox: Here's how mine currently appears: I analyzed their css file and examined their html source code. I isolated the section of html and css related t ...

Minimize JavaScript code for simplifying jQuery CSS modifications (show/hide off-canvas navigation)

I am currently working on developing a custom off-canvas navigation system that is similar to the functionality of Foundation. Essentially, I have 2 icons that trigger CSS adjustments when clicked. I am contemplating whether it is feasible to streamline th ...

React scroll position shifting when state is modified

Attempting to incorporate a basic show more button with react using the useState hook. Everything is functioning properly except for the fact that when the content is toggled, the vertical scroll position abruptly shifts down by the size of the div that wa ...