Issue with nested grid layouts within the 960 grid system

I recently started working on a personal hobby website and decided to utilize the 960 css grid system for organizing my HTML elements on the page.

After grasping the basic concept, I went ahead and created a preliminary version of the website, which is hosted here on my server.

As I delve deeper into this project, I've encountered a few queries:

<div class="container_12">
<div class="grid_12">
    <div id='top_bar' class='grid_insider'><!-- start of #top_bar -->

        <ul id='top_menu' class='grid_5'><!-- start of #top_menu -->
            <li>Home</li>
            <li>Fake1</li>
            <li>Fake2</li>
            <li>Fake3</li>
        </ul><!-- end of #top_menu -->
        <ul id='user_panel' class='grid_2 prefix_4'><!-- start of #user_panel -->

            <li>log in</li>
            <li>faq</li>
        </ul><!-- end of #user_panel -->

    </div><!-- end of #top_bar -->
</div>
<div class="clear"></div>
<div id='title_bar' class="grid_12">
    <h1 id="logo" align='center'>LOGO, TITLE and SLOGAN all go here!</h1>

</div><!-- end .grid_1 -->
<div class="clear"></div>

Using a 12-column grid template, each row should ideally add up to a total of 12 grids. However, I'm facing an issue where only 11 grids worth of elements can be placed on the same row without any conflicts. Adjusting the class of the #user_panel element to "grid_3 prefix_4" causes it to move to the next line, disrupting the layout.

Furthermore, while the top-level elements like top_bar and title_bar are correctly positioned with a width of 940px (verified using a helpful Firefox plugin called gridfox), the nested grids are slightly misaligned from their intended positions.

Being new to this css grid system, I'm wondering if there's a more effective way to manage nested elements. The examples showcased on the 960.gs website are truly impressive!

Thank you in advance for any suggestions!

Updated Information

Following the advice provided below, I understand that it's still possible to use colored borders for debugging the nested grids. An interim solution to maintain grid integrity involves implementing the following CSS snippet:

.grid_insider
{
    border : 1px solid red;
    margin : -1px; /* this prevents element expansion */
}

Answer №1

Have you noticed the framework actually provides a method for nested elements?

/* `Grid >> Children (Alpha ~ First, Omega ~ Last)
------------------------------------------------*/

.alpha {
    margin-left: 0;
}

.omega {
    margin-right: 0;
}

This code adjusts the margins of grid elements to allow them to align with their containers' sides.

To implement this, assign the alpha class to the left menu bar and the omega class to the right one. Then, remove any borders added to these elements and their container. Precision is important when using CSS floats according to the framework's specifications.

If you wish to add borders, you'll need to apply styles that override these default settings while ensuring the widths are slightly smaller than defined in the framework to prevent layout issues.

Answer №2

Apologies for the delay in responding....

You have two options for styling your borders:

`outline: 1px solid red;`

or you can use box-sizing property:

     .gridInsider {
       -webkit-box-sizing: border-box;
       -moz-box-sizing: border-box;
       box-sizing: border-box;
     }

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

Suggestions for creating a <div> that takes up the entire space when using the display property set to flex

html, body { height: 100%; margin: 0px; } .container { display: flex; width: 100%; height: 100%; background-color: yellow; } .box { flex-shrink: 0; } <div> <div class="container"> <div class="box"&g ...

Increase the distance between input boxes using CSS styling

I'm encountering an issue with adding spacing between input boxes, despite attempting to use padding. The padding only seems to move the boxes instead of creating space between them. Here is my code: ...

The circular shape of a border-radius becomes distorted when scaling at various browser zoom levels

My challenge involves a small circle with a 4px diameter that I need to scale using anime.js. While it works perfectly at 100% zoom (default), I also require it to behave consistently across different zoom levels, specifically from 50-100%. To see the iss ...

When writing CSS, ensure there is no space between selectors and classes of elements

Can you explain the distinction between using a css selector (like p) and assigning a class to an element (.cat)? p.cat{ } Vs. p .cat{ } Appreciate your help! ...

When you click on the logo, it will automatically redirect you to a designated Bootstrap Tab and set that tab

After searching through numerous posts, I am still struggling to find a solution to my straightforward issue. My requirement is simple: when a user clicks on the brand (logo), it should not only redirect them to a specific tab but also make it appear as a ...

Creating manageable CSS styles for a wide variety of themes

I need to add themes to a web application that allows users to switch between them seamlessly. The designers want a variety of font colors and background colors, around 20 in total. Is there a way to achieve this without creating multiple .css files, which ...

Exploring the power of CSS using :after and :nth-child selectors

.app-btn { font-size: 0px !important; } .app-btn:after { content: '+2500'; visibility: visible; font-size: 15px !important; } .app-btn:after:nth-child(1) { content: "+18000"; } .app-btn:after:nth-child(2) { content: "+14000"; } < ...

Display a full-width card beneath each small card in every row using CSS

In a scenario where I have designed a layout consisting of 3 column/row cards across multiple rows. Each card displays basic information, and when a user clicks on any specific card, a full-width card below that row will display more detailed information. ...

Implementing both fancybox and a hover remove icon functionality on a single image

I came across a solution on this question here, outlining how to implement an overlay hover remove icon on thumbnails. I tried incorporating it into my page, along with fancybox, but unfortunately, I'm encountering issues getting both functionalities ...

Modify the background color of four results with the help of PHP

With php, I am looking to dynamically change the background color of a td based on the number within it. While this can be achieved using CSS by assigning different classes to each td with specific colors, I prefer a more straightforward method for mainten ...

The iPhone display scaling issue is causing difficulty viewing the entire website

Currently experiencing difficulties with a page that lacks sufficient content, resulting in a smaller height. As a result, the iPhone is scaling the page and cutting off the full menu bar (960px wide). I attempted to set a minimum height using a media quer ...

Do not include JavaScript-generated CSS when running Grunt's un-css task

Recently, I started using Grunt for minifying JavaScript and CSS files and I must say, it's an incredible tool. As I delved deeper into Grunt, I discovered the uncss module, which aids in optimizing the load time and size of CSS files, especially for ...

I'm having trouble displaying the X's and O's in my tic tac toe JavaScript game. Any suggestions on how to resolve this issue?

After following a couple of online tutorials for the tic tac toe project, I encountered an error in both attempts. The X's and O's were not displaying even though all other features were working fine. Below are my codes for HTML, CSS, and JavaScr ...

"JQuery event handlers not functioning as expected: .click and .on failing

For some time now, I've been facing this issue and I'm at a loss trying to figure it out. I have attempted various solutions such as using .click(), .on(), .delegate, and even utilizing .find() to locate the specific element causing the problem. ...

Changing the background color to white causes the progress bar line to become indiscernible

Here's how my form appears: https://i.sstatic.net/jXCxm.jpg Once I set the container to be: <div class="container" style="background:white;"> https://i.sstatic.net/DZjAK.png I want to make it white and ensure that the prog ...

JavaScript - continuously update the image marked as "active"

I have a collection of 4 pictures that I want to rotate through in my web application. Each picture should have the "active" class applied to it, similar to when you hover over an image. .active, .pic:hover{ position: absolute; border: 1px solid ...

Positioning an image/carousel at the bottom of multiple without the need for alignment

I'm in the process of creating a single-page website with sections stacked on top of each other, including a section where divs are stacked both next to and on top of each other. Within this section, there is a container div that holds 5 divs named bo ...

Customizing button widths in CSS for landscape and portrait orientations with Bootstrap styling

How can I make multiple buttons in a container have equal width and resize when in landscape mode or on a wider screen? My goal is to achieve the following: https://i.sstatic.net/J8opN.png https://i.sstatic.net/NZSjj.png However, when I switch back to ...

Fit the image to fill the available space and position it in the center for maximum impact

I'm currently working on a single page application where I need to display an image that fills up as much available space as possible: Priority: maintain the aspect ratio Avoid cropping the image Stretch the image horizontally and/or vertically (with ...

Ways to resolve issues with resizing div elements while waiting for JavaScript to load

Apologies for the lack of a clear title to describe my issue. My problem involves this snippet of code, where I am creating a label to show time to users. <div class="content"> <div class="container"> <div class="card"> < ...