Chrome does not re-calculate width when height changes
My solution: Solution playground
The idea is to trick Chrome to re-calculate the width, by giving the image a new height that is almost the same on the li:hover
state. BUT this isn't enough for Chrome. transitions must also be applied on the img
. This is all voodoo coding, but this is the least-ugly solution I could come up with:
ul{ list-style:none; display:inline-block; height:80px; white-space:pre; width:100%; }
li{ display:inline-block; vertical-align:middle; height:60%; -webkit-transition:.2s; transition:.2s; }
li:hover{ height:100%; }
li a{ height:100%; padding:0 2px; display:block; }
li a img{ height:96%; -webkit-transition:.2s; transition:.2s; }
li:hover a img{ min-height:96%; }
Chrome does not re-calculate width when height changes
My solution: Solution playground
The idea is to trick Chrome to re-calculate the width, by giving the image a new height that is almost the same on the li:hover
state. BUT this isn't enough for Chrome. transitions must also be applied on the img
. This is all voodoo coding, but this is the least-ugly solution I could come up with:
ul{ list-style:none; display:inline-block; height:80px; white-space:pre; width:100%; }
li{ display:inline-block; vertical-align:middle; height:60%; -webkit-transition:.2s; transition:.2s; }
li:hover{ height:100%; }
li a{ height:100%; padding:0 2px; display:block; }
li a img{ height:96%; -webkit-transition:.2s; transition:.2s; }
li:hover a img{ min-height:96%; }
Chrome browser calculates the wrong element width
Found out that this is something to do with linebreaks / wordbreaks ...
So the first (raw) solution is to keep all the heading text in one line.
.project-info .item .heading {
...
white-space: nowrap;
}
However I'm still looking for a proper answer to allow the heading text stack up in multiple lines.
Chrome doesn't update the element's width at some condition, is it a bug?
I believe this is a bug in WebKit. I filed WebKit bug 104872 for this.
Chrome does not show width and height of screen when inspecting the page with Inspect
As of May2016, Chrome has this functionality again.screen dimensions
Chrome not calculating column height correctly after JS resizing li elements in multicolumn div
This indeed seems to be a chrome bug:
https://code.google.com/p/chromium/issues/detail?id=297782
Here's the workaround I found, a little JS script which resets the CSS class, with a delay. Without the delay it won't work.
var cols = $(".multiColumn").css("-webkit-column-count");
$(".multiColumn").css("-webkit-column-count","1");
setTimeout( function(){
$(".multiColumn").css("-webkit-column-count",cols);
},1);
Chrome does not showing width of screen as screen resize?
Just updated to Chrome 49 and learned that there is indeed a bug causing this issue.
CSS3 calc(100%-88px) not working in Chrome
The problem in the question was caused by the lack of space around the subtraction operator.
Note that the grammar requires spaces around binary ‘+’ and ‘-’
operators. The ‘*’ and ‘/’ operators do not require spaces.
https://www.w3.org/TR/css3-values/#calc-syntax
This article mentions that the spacing is necessary for unambiguous parsing.
Bad: calc(100%-88px)
Good: calc(100% - 88px)
How do I know it is not recognizing it? Because of the strikethrough
and the yellow triangle icon next to the style rule in chrome dev
tools.
A property that is struck through when viewed in Chrome's developer tools may be valid but overridden; however, a property struck through and with a warning triangle icon next to it is invalid.
2022 Update - calc()
is supported by all modern browsers in a wide variety of scenarios, though proper spacing is still required.
Related Topics
Susy 2.0 Change Columns at Breakpoint
CSS: Table and Table-Cell Replacement for Ie7
What Actually Happens to CSS in High Contrast Mode
Does Display:None Still Use Performance of Rendering
How to Add Linear-Gradient Color to Slider
CSS Backdrop-Filter Does Not Update When Content Behind It Moves
CSS Margin Strange Behavior, Why
Styling Polymer Element in Angular2
Horizontally Centering Elements to Their Container While Avoiding Overlap
Setting Linear Gradient Height and Width
Centering in CSS, When The Object Is Larger Than The Viewport
Horizontal Sharp Background Gradient with Specific Length of First Color
Apply External CSS to Specific Area
@Font-Face with Embedded Font Does Not Work
Bootstrap 3 Full Width Image and Div in Container
CSS Flexbox: a Centered Child Overflows a Parent with Position Fixed