Innovative: Enhancing column width dynamically without compromising grid integrity

Currently, I am utilizing Bourbon's Neat library to structure my grid system.

Within my code, I have the following setup:

section {
  @include outer-container;
  aside { @include span-columns(3); }
  article { @include span-columns(9); }
}

The challenge I am facing is that I would like to expand the width of the aside element by 50px when hovered over. Nevertheless, doing so causes the article to shift to the next line.

Is there a method to adjust the width of one column and automatically resize the other column accordingly?

I am aware that this can be achieved with JavaScript, but I am curious if there is a way to accomplish this using the Neat grid-system.

Thank you!


UPDATE

After testing, I successfully implemented the following solution:

section {
  @include outer-container;
  aside { 
    @include span-columns(3);

    &:hover {
      @include span-columns(2);

      & + article {
        @include span-columns(11);
      }
    }
  }
  article { @include span-columns(9); }
}

By utilizing the CSS sibling selector +, I can select the article element when hovering over the aside.

Answer №1

If you’re looking to achieve this effect, there isn't a ready-made solution, but have you experimented with adjusting the width property on :hover? In other words, you can increase the width of Column A by a certain amount while simultaneously reducing it from Column B. The CSS function calc() could be useful in this scenario.

For more detailed information on how span-columns functions and its results, you can refer to Neat’s documentation:

Alternatively, if your requirements permit, using flexbox could be a more efficient approach for handling this layout.

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

Buttons are not aligned with the rest of the row's height

I'm currently working on designing an upload layout that consists of a container with a row inside. Within the row, there are two buttons (each containing input elements) and one h3. For some reason, I am having difficulty getting them to align at the ...

Tips for ensuring that the horizontal scroll bar remains consistently positioned at the bottom of the screen

There are two div sections on a page, with one positioned on the left and the other on the right. The div on the right contains multiple dynamically generated tags which necessitate a horizontal scroll bar (overflow:auto). This causes the div's height ...

Stop the Nav bar item from collapsing

Alright, let's talk about the scenario: The situation is that I have a basic, plain, nav nav-tabs navigation bar with a few elements and a rightmost item (with pull-right) positioned as an <li> element which includes a dropdown. As the window ...

Enhancing website aesthetics through CSS styling

My goal is to create websites with a fresh, updated design. One example of a site I admire is Manta Media Inc I assume that CSS plays a big role in achieving this look. What keywords should I use when searching on Google to learn how to build a web inte ...

The CSS and JavaScript in pure form are not functioning properly upon deployment in Django

In my Django project, I am utilizing pure CSS and Bootstrap. Everything appears as expected when I test it on my local machine. However, once deployed, the appearance changes. The font looks different from how it did before deployment: After deploying to ...

Having trouble converting svg to png, thinking it might be due to discrepancies in svg elements

I am facing a puzzling issue where two different SVG elements are causing my JavaScript to work in one scenario but not the other. I have replaced the SVG elements in both examples, and surprisingly, only one works while the other does not. You can view th ...

The JQuery chosen dropdown experiences a visual issue when placed inside a scrollbar, appearing to be "cut

Good day, I've been using the jQuery "chosen" plugin for a dropdown menu, but I encountered an issue with it being located in a scrollable area. The problem is that the dropdown items are getting cut off by the outer div element. I have provided a si ...

Is there a CSS alternative to using <br clear=all> on divs that do not have set heights?

Back in the day, I used to rely on <br clear=all> at the end of a div, without specifying a height value in CSS, just to control its height. These divs would expand and contract based on the content within. Is there a more elegant approach to make ...

CSS Resizing the screen leads to misalignment of the footer layout

I am currently working on a page located at However, I have encountered an issue where the footer is not displayed properly when the screen size is changed. Below is the CSS code for the footer: #footer_1 { background: url("../images/bgfooter2.png") ...

What could be the reason my CSS and Javascript animation is not functioning properly?

Currently working on creating a dynamic animation menu using CSS and Javascript, but encountering some issues. The concept involves having a menu with initially hidden opacity (using CSS), which becomes visible when the hamburger menu is clicked, sliding i ...

Switch up the appearance of a document by manipulating the stylesheet using a select tag

I'm currently facing an issue with the implementation of a drop-down box on my website for selecting different themes. Despite having the necessary javascript code, I am unable to get it working correctly. Here's the snippet: //selecting the sele ...

Stacking parent elements above children in CSS styling

I am encountering an issue with the following DIV structure: <div id="parent"> <div id="child"></div> <div id="child2"></div> </div> My goal is to have a partially opaque background for the parent DIV and fully visible ...

Step-by-step guide to showing a div upon clicking an element using jQuery

I am facing a challenge with an invisible div that I need to make visible upon clicking an element. However, my current approach does not seem to be working. Can you help me figure out what I am missing? I attempted to target <a class=".demo"> using ...

I am in search of a clean and efficient method to modify the class of a link that triggers an HTMX request in Django. Perhaps something like "auto-refresh" or a similar solution would be ideal

I've encountered an issue with HTMX in Django. The page consists of two main components: a list of categories and the content that is displayed when a category is clicked. Initially, everything was working smoothly with standard htmx functionality. H ...

Creating an Image Slideshow on Your Website

I'm looking to create an image slideshow on my website that functions similarly to the one found at . However, I want the images to occupy the entire screen rather than having smaller images like the reference site. Can anyone offer guidance on how t ...

Clicking on a React component will result in highlighting

What's the best way to display the selected item after a user clicks on it? <Box py={2}> <Grid container width="330px"> <Grid container direction="column" item xs align="left"> ...

Switching the cursor to an image when hovering over an element is causing inconsistency in hover events triggering

Currently, I am attempting to implement an effect that changes the cursor to an image when hovering over a text element and reverts back to the normal cursor upon leaving the text element. However, this functionality is not working as expected when using R ...

Set the styling of a div element in the Angular template when the application is first initialized

I have a question about this specific div element: <div class="relative rounded overflow-clip border w-full" [style.aspect-ratio]="media.value.ratio"> <img fill priority [ngSrc]="media.value.src || ftaLogo" ...

What about nested elements with percentages, set positions, and fixed placements?

Picture: https://i.sstatic.net/KFNR1.png I am working on a design with a yellow container div that I want to keep at 50% width of the window. Inside this container is a purple image div that stretches to 100% of the parent container's width, and ther ...

What is the best way to create a new variable depending on the status of a button being disabled or enabled

Imagine a scenario where a button toggles between being disabled when the condition is false (opacity: 0.3) and enabled when the condition is true (opacity: 1). Let's set aside the actual condition for now -- what if I want to determine when the butt ...