What is the best way to adjust the size of a column when hovering

What I am attempting to achieve is,

I would like the column box to have a 100% width, and when it is hovered over, I want it to transition to the left, with the width of the column box being about 60%, revealing a second block that shows up as 20% width only when you hover over the first block.

You can find my css and html in this link.

Think of it like this:

For example, if I use

<div main>
 <div left60%>
  <div right40%>
</div main>

When hovering over the main div, the left div should maintain a 60% width, while the right div maintains a 40% width.

Answer №1

It's not entirely clear what your goal is, but I believe this solution may be what you're looking for: JSFIDDLE

I updated the code for your box to:

.box{
    transition:2s;
    width:100%;
}

In addition, I included this snippet to show block20 when hovering over .box:

.box:hover + .block20{
    display:block;
}

To ensure that block20 remains hidden until triggered, I set its display property to none.

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

Tips for adjusting the width of an HTML element that is set to position: fixed

<div class="ui-datatable-scrollable-view" style=" width: 100%; position: relative; "> <div class="ui-widget-header ui-datatable-scrollable-header" style="position:fixed;top:50px"> </div> </div> ...

offspring of offspring in jquery animation remains stationary

I'm experiencing an issue with a jquery animation on containers that are set to 100% width and height. Specifically, the children elements that have position absolute move with the container, but when a child of a child has two instances of position a ...

What is causing the resistance in changing the color of my current navigation items?

I've encountered a small challenge with my header section. Despite multiple attempts, I'm struggling to change the color of the 'current' menu item. It seems that overriding Bootstrap's default color is proving to be more difficult ...

What is the best way to ensure the active tab remains visible?

I am using the bs-admin-bcore Bootstrap theme and I am looking to enhance the dynamic functionality of the menu in the "menu.php" file. Here is an example of the current code: <ul id="menu" class="collapse"> <li class="panel"> < ...

Ensuring that a minimum of one checkbox has been selected

When employees submit a work order, they fill out a form that includes a section titled "Departments Affected" with checkboxes for 5 different departments. The form is set up so that at least one department must be checked before it can be sent. I have imp ...

How does HTML calculate the percentage-based size of a child element when the parent element has padding?

After analyzing the scenario presented, it appears that the outer yellow box is 240px wide (200 width plus 20 padding on each side). The red child inside has its width set at 50%. Surprisingly, when rendered, the red box measures 140px in width. You can v ...

What is the best way to retrieve a lengthy HTML page string parameter from a Java request?

While working with Javascript, I encountered an issue with sending HTML pages in post data. In my Java code, I used String html = request.getParameter("templateHtml"); and during debugging, I could see the HTML string in the request. However, the "html" va ...

How can I change :hover to a clickable element instead?

I attempted to create a full-width accordion with the following code: .page { margin: 0; padding: 0; display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; height: 100vh; } .content { -webkit- ...

Issue encountered with mouse handling on SVG elements that overlap is not functioning as anticipated

I am working with multiple SVG path elements, each contained within a parent SVG element, structured like this: <svg class="connector" style="position:absolute;left:277.5px;top:65px" position="absolute" pointer-events:"none" version="1.1" xmlns="http:/ ...

Pass a string to a function and receive a JSON response

I'm new to working with jquery and ajax. I have a function that retrieves data and I want to access it through ajax. My function: public JsonResult FillSubject(string GroupServiceID) { //string GSID = GroupServiceID.Substring(1, (GroupServiceID. ...

Use jQuery's AJAX function to upload an array

Having a bit of trouble with a seemingly simple task. I need to send a multi-dimensional array to a php page using jQuery's .ajax function, but I'm struggling to serialize the array correctly. This is the code snippet: var dataToSend = new Arra ...

Using AngularJS to implement validation on radio buttons

My application is a cross-platform app that utilizes AngularJS, Monaca, and Onsen UI. Within one of the views, there exists an array of list items where each item can be associated with a random number of radio buttons. These lists are dynamically generat ...

Saving an Echo Command in a Variable

I've set up an eye exam program and now I'm trying to figure out how to display the results only after the exam is completed. The issue is that when I echo the stored SESSION variables containing the results, they are displayed even on page refre ...

What is the most effective method for attaching a jQuery click event to every anchor tag within each row of a table?

Displayed here is a grid (basic html table) showcasing users with the option to delete a specific user by clicking on the delete link. My typical approach involves: <% foreach (var user in Model.Users) {%> <tr > <td align="right"><% ...

What is causing the dysfunction of angular2 form when used with the HTML <form> tag?

Can someone explain the strange behavior of the <form> element in ng2 to me? I have noticed something odd and need some clarification :) To demonstrate, I have created a simple Plunker example at this link: https://plnkr.co/edit/vdrHJBNdd26y6YhPXTHD ...

Having trouble directing input to embedded swf upon page load in Opera

I have created a basic HTML file designed to display embedded flash content immediately upon loading, without requiring any prior interaction. Unfortunately, I have encountered an issue in my preferred browser, Opera. The problem seems to be isolated to th ...

Tips for utilizing both the Element Selector and Class Selector in Jquery

I am working with a simple table that has TDs assigned either the 'PLUS' or 'MINUS' class. My goal is to use jQuery to implement functionality for collapsing all or expanding all. When the Expand All button is clicked, I need to chang ...

How do I position an input box at the bottom of a split window using CSS?

I am grappling with maintaining the alignment of an input box underneath a chat window while using the float:left property. As there will be multiple chat windows and I want them to remain next to each other, I am uncertain about how to achieve this. Chec ...

Positioning absolute elements negatively in Firefox may cause unexpected behavior

I attempted to position an absolute element with a negative value, and it works perfectly in every browser except for Firefox. In Chrome, IE, or Safari, the blue handler box is correctly positioned in the middle of the top border. Is there a workaround to ...

What steps can be taken to create a two-column layout using the provided HTML code?

I'm having trouble getting my CSS to work properly in IE 8. Any suggestions on how to fix this? Here's the simplified HTML code I'm using: <div id="column-content"> <div id="content"> <p>This is some text</ ...