Background that stretches to 100% width but only fills to the right side

UPDATE: I figured out why it wasn't working - the element with a width of 100% was nested inside a div with the class "container," removing that solved the issue! (I don't have enough reputation to answer my own question yet, just wanted to update viewers that it's fixed now.)

I've been experimenting with the blueprint CSS framework on my own and I'm facing an issue with the following HTML/CSS code. The bigBox class doesn't stretch to 100% of the page width as intended (it fills up to the right but aligns with other content on the left).

Any suggestions on how to make this work correctly? Thank you!

<head>
    <title>Hello</title>
    <!-- screen is default blueprint framework file -->
    <link rel="stylesheet" href="screen.css" type="text/css" media="screen, projection" />  
    <!-- import custom styles -->
    <style>
        #topmenu {float:right; margin-top: 50px; /*margin-right: -30px;*/}
        #topmenu ul {list-style: none outside none; }
        #topmenu ul li { display: inline;  }
        #topmenu ul li a { text-decoration: none;  
                           padding: 5px;}
        #topmenu .last { padding-right: 0px; }
        #topmenu .current { font-weight: bold; }

        .bigBox { width: 100%; position: absolute;
                 background-color: blue; height: 430px;
                }
    </style>
</head>

<body>
    <div class="container">

        <!-- logo -->
        <div class="span-12">
            <h1>Hello World</h1>
        </div>

        <!-- top menu -->
        <div class="span-12 last">
            <nav id="topmenu">
                <ul>
                    <li class="current"><a href="">Option 1</a></li>
                    <li><a href="">Option 2</a></li>
                    <li><a href="">Option 3</a></li>
                    <li class="last"><a href="">Option 4</a></li>
                </ul>
            </nav>
        </div>      

        <br class="clear"/>
        <div class="bigBox">
            <div class="span-14">
                <h2>Content Left</h2>
            </div>
            <div class="span-10 last">
                <h2>Content Right</h2>
            </div>
        </div>


    </div>
</body>

Answer №1

"I discovered the issue causing it to not work was that the element set to width: 100% was contained within a div with class="container". Once I removed that container, the problem was resolved!"

Answered and marked as Community Wiki for your convenience.

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

Assistance needed with Chrome extension - seeking guidance on how to include the URL of the current page into the HTML of the default popup in the manifest.json file

I have a manifest file that looks like this: { "name":"Improve the Web extension", "version":"0.2", "manifest_version":2, "description":"Enhancing web accessibility is crucial. Poorly designed websites can exclude disabled individuals. By ...

Place image in the center with no hyperlink and adjust width to 100%

Is there a way to center my Logo while ensuring that the hyperlink only covers the image itself, rather than extending to 100% width? I want my logo centered and still have the link confined to just the image area. https://i.sstatic.net/Ko9E6.jpg ...

Issue with Flask form submission in a specific scenario but functioning correctly in a different context

I'm currently working on a flask website, and I'm facing an issue with the SubmitField not functioning when I click it. I tried a similar method with a smaller form and it worked, but for this specific case, it's not working. routes.py from ...

Webkit feature: Rounded border image overlay

One issue arises when applying a rounded border to an image in webkit browsers as the border ends up hidden behind the image. CSS img { border: 10px solid #000; border-radius: 100%; } HTML <img src="http://25.media.tumblr.com/tumblr_mbje ...

Various Mobile Devices Display Website in Unique Ways

I've been having trouble getting my website to display consistently across different phones and could use some assistance. You can view the site at www.fpphotos.store. I have set overflow-x:auto; for the table containing the images, with CSS styles de ...

How can I update the value of one select tag when another select tag is changed?

My web page contains two select options as shown below. https://i.sstatic.net/kmDv3.jpg There are two select options labeled as #age1 and #age2, with age values ranging from 18 to 30. I want to ensure that when a user selects an age from #age1, the minim ...

Validation of forms using jQuery validation in conjunction with the bootstrap confirmation plugin

I have a form that is validated using the jQuery validation plugin. Recently, I added a bootstrap confirmation to the submit button with success. However, I am facing an issue where I want the bootstrap confirmation to only appear on the submit button when ...

Tips for adjusting the size of a container to fit its child element in a flexbox layout, where the flex-direction is set to column

Below is the functional code: .container{ display: flex; background-color: lightgreen; justify-content: center; alighn-item: center; } .child{ margin-left: 10px; height: 200px; background-color: yellow; display: flex; flex-direction: ...

Ways to deactivate the submit button using Cookies, sessions, or local storage

Although cookies and storage can be deleted, they can still help prevent many human spammers who are unaware of this. How can I temporarily disable the form submit button on a specific page for just one day? I want to create a code that saves "Submitted" ...

Surprising sight of a blank canvas behind the font-awesome icon

Is there a way to remove the unexpected white background that appears when adding a font-awesome icon? Here is the HTML code: <div class="notifications-window" id="close-notifications"> <div class="notifications-header&qu ...

Choose an element by its specific data attribute

I have come across this html code and I am attempting to assign a new class to it using the data attribute: <p class="form-row form-row-wide" data-child-field="child_has_jacket"> </p> Even after trying with jQuery : jQuery( ...

What measures can be taken to prohibit a user from accessing a client-side HTML file using express?

I am currently developing a task management application called "todolist." In my node.js code, I utilize express and grant it access to my directory named Client: var app = express(); app.use(express.static(__dirname + "/Client")); The contents of my Cl ...

Customizing default elements in A-frame: Tips and Tricks

One of the default components attached to an A-frame entity is rotation and position. I am looking to customize these components and apply the changes to the entities. For instance, I would like to create a new component called "positionnew" with a differ ...

Exploring the intricate design and information dynamics of MRAID 2

I am currently in the process of developing a new MRAID (v2) compliant SDK for Android that will enable rich media ads to be displayed within various android apps. Additionally, I plan to implement a backend platform that allows advertisers to create their ...

Calculating dimensions for parents and their children

Could someone please explain to me why the size of #child is different from that of #parent? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.or ...

The JavaScript function modifies the value stored in the local storage

I'm in the process of developing a website that requires updating the value of my local storage when certain JavaScript functions are executed. Currently, I have this code snippet: localStorage.setItem('colorvar', '#EBDBC2'); I&ap ...

Avoiding the appearance of a scrollbar when content extends beyond its containing block

I am struggling with writing markup and CSS to prevent a background image from creating a scrollbar unless the viewport is narrower than the inner content wrapper: The solution provided in this post didn't work for me: Absolutely positioned div on ri ...

how can the class hide be removed when hovering over each link

How can I remove the class hide from a div with the class popover when hovering over each link? I have tried implementing the code below, but it doesn't seem to be working as expected. $(document).ready(function() { $(".myPopover").each(function( ...

Hover Over - Display MySQL Information

Currently, my code looks like this: <?php $mysql_hostname = "localhost"; $mysql_user = "root"; $mysql_password = "password"; $mysql_database = "test_db"; $bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Oops s ...

What strategies can be used to scale up a website's images in proportion to their page views or traffic?

The situation: On my simple HTML website, I have a group of images placed side by side. Each image is connected to a specific article, and when you hover over the image, a detailed description of the linked article pops up in the center of the page. The o ...