Issue with wrapper functionality and page scaling

I am facing another issue. I have created a #wrapper on my page to manage the width of the content, but... It does not work properly on screens larger than 1366px.

When tested on a 1920 screen, the debugger showed that the total width of the wrapper was only 1244px (not 1920px). The same problem occurred on a 4k TV - the page appeared "scaled" to the wrapper width. It seems like the full width of the page is being controlled by the wrapper and any 'width: 100%' settings on body/sections are being ignored.

Do you have any idea where the issue might be? Setting !important on the wrapper hasn't made a difference, max/min width is not working either. Changing units to vw has not solved it. Even removing/changing meta tags did not help. And there are no other tags overriding the wrapper. The styles were cleared using SCSS Reset at the beginning. What could I possibly be doing wrong?

html, body {
        height: 100%;
        width: 100%;
        margin: 0;
        padding: 0;
    }
    .aaa {
        width: 100%;
        height: 300px;
    }
    #wrapper {
        width: 1224px !important;
        margin: 0 auto !important;
    }
    <html>
    <head>
    <meta http-equiv="content-type" content="text/html" charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="Stylesheet" type="text/css" href="css/style.css">
    </head>
     <body>
        <section class="aaa">
            <div id="wrapper">
                <h2>content</h2>
            </div>
        </section>
     </body>
    </html>

    

The desired setup should look like this:

[-margin-[-wrapper 1224px-]-margin-]

[------------------1920px-----------------]

However, on a 1920px resolution screen, it currently looks like this:

[--wrapper 1224px----]

[-1224px in debugger-]

Even with a screen resolution of 1920px

Here is a link to the troubled page: www.xileo.pl

And here is an image from a 4k screen:https://i.sstatic.net/ZH4UR.jpg

As depicted in the image from a 3840px screen, the wrapper was scaled to 3840px instead of remaining at 1224px with margins. I want the wrapper to stay at 1224px with margins.

Answer №1

If my interpretation is correct, give this a try:

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}
.aaa {
    width: 100%;
    height: 300px;
}
#wrapper {
    max-width: 1224px;
    margin: 0 auto;
}

If this doesn't solve the issue, share a jsfiddle link for further assistance.

*Update: I included a screenshot from a screen close to 4k resolution; however, it seems your screen may not be true 4k or there could be some scaling issues. You may need to debug this further. Everything else appears to be functioning as expected. It's possible that there is another CSS rule overriding the code you shared, so ensure that the partial code you provided is working correctly.

https://i.sstatic.net/a4bXC.jpg

Answer №2

Updated: https://jsfiddle.net/8yt3fp0k/ I was able to get the CSS working, but it seems like there might be an issue with the SCSS code. It's possible that another #wrapper is defined elsewhere outside of the provided snippet.

CSS:

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}
.aaa {
    width: 100%;
    height: 300px;
}
#wrapper {
    width: 1224px;
    margin: 0 auto;
}

Answer №3

If you're looking to adjust the layout for larger screens, simply modify the width property:

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}
.container {
    width: 100%;
    height: 400px;
}
#main-content {
    width: 1400px; 
    margin: 0 auto;
}
@media only screen and (max-device-width: 1400px) {
 #main-content {
    width: 100%;
    margin: 0 auto;
}
}

Answer №4

Updated answer following modifications to the question and insertion of a link to the original website:

The existing rule is as follows:

.index .main-page .main .main-box .about-us {
    width: 100%;
    padding-right: 370px;
}

This particular rule results in a significantly large right padding for the upper text block, thereby reducing its overall width. To have the about-us section span the entire width of the wrapper, you can remove this rule.

If you prefer the .about-us to be narrower and centered horizontally within the initial wrapper, simply adjust the rule like so:

.index .main-page .main .main-box .about-us {
    width: 1224px; /* choose any suitable value */
    position: relative;
    margin: 0 auto;
} 

In addition, please keep in mind these two important points:

1.) The wrapper has a maximum width limit of 1224px and is utilized in other sections as well. Should you wish for the subsequent section (featuring four text blocks) to expand across a wider screen, make amendments to the width and max-width parameters in the wrapper rule.

2.) Multiple instances of the wrapper are being used, each associated with an ID which should ideally be unique on a single page. In order to ensure consistency, update #wrapper to

.wrapper</code in the CSS file, and alter all occurrences of <code>id = "wrapper"
attributes within your HTML elements to class = "wrapper".

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 process for detaching and attaching click animations using the on() method?

I am encountering an issue with a recursive loop that executes a simple animation. These animations are controlled by the page load and clicking on controls .carousel_item. Click here for live sample JSFiddles for demonstration purposes Challenge: The pr ...

Rearrange the order of items in the fancybox gallery

Typically, fancybox displays items in the gallery based on the order they are added in the HTML code. Is there a way to customize the order of items when they are opened in the popup, while keeping the original order when displayed on the page? The solut ...

Designing an accordion with the main content peeking out slightly before collapsing into place

Seeking assistance in creating an accordion that displays a snippet of content before collapsing. I'm facing difficulty starting this project. While a basic accordion is simple to implement, I am unsure how to show a portion of the content (such as t ...

An innovative approach to loading tabs dynamically using Materialize CSS

I have a situation where I am dynamically generating a set of tabs when the page loads, but for some reason the on function is not recognizing it. How can I fix this issue? Here is the current code: HTML <div class="row"> <div class="col s12 ...

Utilize the input type=date value in the date function to obtain a specific format

How can I pass the value of input type=date to a JavaScript date function? In my HTML code, I have used: <input type=date ng-model="dueDate"> <input type="time" ng-model="dueTime"> <button class="button button-block" ng-click="upload_dueda ...

How can I center the navbar logo and use it as a toggle for collapsing the menu?

This is a simple example of a navigation bar <nav class="navbar navbar-expand-lg bg-light"> <div class="container-fluid"> <a class="navbar-brand" href="#">Navbar</a> <button class ...

Removing Hidden Menu Options within WordPress

I need help deleting a hidden menu item, and I'm unsure of the potential impact on my other menu items. Thank you for your assistance. The website in question is www.rannitv.com/magazine View screenshot of the menu item here ...

How can input be fixed in place within a list inside an Ionic framework popover?

I have the following code in a popover template: <ion-popover-view class="customPopup"> <ion-header-bar class="bar bar-header barHeaderCustom"> <h1 class="title">{{ 'AVAILABLE_SOUNDS' | translate }}</h1> </io ...

Encountering issues with CSS Modules in Next.JS app while using app/about/layout.tsx

Currently, I am delving into the world of Next.js and encountering some challenges with locally scoped CSS modules. In my project, I have an about directory which contains a layout component. Strangely, the styles applied to the layout component are not b ...

The progress bar seems to be malfunctioning

Need help with my progress bar, it's not working properly. Can someone assist me? var x = document.getElementById("p_bar"); for(var i = 0; i < 100; i++) { var wid; wid=1; if(wid == 800) break; else wid+=8; x.style.width=wid+" ...

The tab-width property in CSS allows you to specify the

Are there methods in WebKit and Microsoft browsers to specify tab width as in Firefox and Opera with -moz-tab-size and -o-tab-size properties? For instance, I would like the tabs in my <textarea> to be 4 spaces wide: textarea { -moz-tab-size: 4 ...

What is the best way to retrieve an item if it is a sibling of a specific tag?

My HTML document is quite lengthy, but here's a snippet: <tr> <td data-bind="text:name, css: isActive() ? 'variable-active': 'variable-inactive'" class="variable-active">Vehicle</td> &l ...

Insert a parameter into a click function within the identifier attribute

I am working with the following HTML markup: <div id="div1" class="divs">some content</div> <div id="div2" class="divs">some content</div> <div id="div3" class="divs">some content</div> <div id="div4" class="divs"> ...

Is Search Highlighting Keywords Causing Issues with URL Variables?

In my current javascript function, I am using the following code to highlight keywords: for (var i = 0; i < keywords.length; i++) { var a = new RegExp(keywords[i], "igm"); container.innerHTML = container.innerHTM ...

What is the best way to make Marquee text begin at the bottom of the screen?

Hey there! Right now, I'm using the marquee feature to scroll from bottom to top and it's all good except that it's starting from the middle of the screen. What I really want is for it to start from the bottom. <!DOCTYPE html> <htm ...

Struggling with Compatibility Issues Between LESS and Twitter Bootstrap

Currently, I am in the process of building a complex WordPress website using the 320press Twitter Bootstrap theme and incorporating LESS CSS. Here are some key details to keep in mind: WordPress 3.5 Bootstrap 2.0 LESS 1.3.3 Everything seems to be fun ...

Is there a way to use jQuery to centrally align the accordion item that I have chosen?

My attempts to use `this.scrollIntoView({behavior: "smooth"}) were yielding inconsistent results in terms of where the selected item would land on the page. I believe I might need to utilize scrollTop(), but as someone who is new to jQuery, I am ...

Is there a way to create a dropdown selection for font families with vue js?

Here is a select element with font families that I want to apply to my texts: <select v-model="focused_font"> <option value="" disabled selected>Font</option> <option v-for="font in available_fonts" ...

What is the syntax for implementing an if-else statement?

Just starting with algolia and looking for a hit template. Please take a look at the script below for the text/html template needed: <script type="text/html" id="hit-template"> <div class="hit"> <div class="hit-image"> <i ...

How to responsively position and scale a background image for a full-width div

Here is the situation: I have an SVG with dimensions of 1920*1920 pixels () This is what I require: I intend to use it as a background-image for a div that spans the full width of the screen. The background image for the div must be responsive. An essent ...