Is it possible to use vh minus pixels in a CSS calc()?
It does work indeed. Issue was with my less compiler. It was compiled in to:
.container {
min-height: calc(-51vh);
}
Fixed with the following code in less file:
.container {
min-height: calc(~"100vh - 150px");
}
Thanks to this link: Less Aggressive Compilation with CSS3 calc
How do I use calc(100%-50px) to minus the pixels from the top?
You can place it on top by
.treemap-chart-container { display: flex; flex-direction: column-reverse; }
Then you may place it on bottom again
.treemap-chart-container { display: flex; flex-direction: column; }
sass: calculation between vh and px
Try using CSS calc. It's pretty widely supported.
.slideshow {
height: calc( 100vh - 70px );
}
CSS `height: calc(100vh);` Vs `height: 100vh;`
There's no difference, since any time the expression calc(100vh)
is calculated, it always ends up being 100vh
.
How to prevent Less from trying to compile CSS calc() properties?
Less no longer evaluates expression inside calc
by default since v3.00
.
Original answer (Less v1.x...2.x
):
Do this:
body { width: calc(~"100% - 250px - 1.5em"); }
In Less 1.4.0 we will have a strictMaths
option which requires all Less calculations to be within brackets, so the calc
will work "out-of-the-box". This is an option since it is a major breaking change. Early betas of 1.4.0 had this option on by default. The release version has it off by default.
JQuery Get element .height() then subtract 100vh?
vh
is a unit representing 1% of the Viewport Height
window.innerHeight
is the px value of the height of the viewport
Being as both of these are targeting the layout viewport, you should be fine to do:
let myHeight = $('#luxy').height() - window.innerHeight;
How to use calc() in tailwind CSS?
theme()
Use the theme()
function to access your Tailwind config values using dot notation.
This can be a useful alternative to @apply
when you want to reference a value from your theme configuration for only part of a declaration:
.content-container {
height: calc(100vh - theme('spacing.7'));
}
Related Topics
Background Color of Tspan Element
Selector for Nth Nested Elements
How to Target a Specific Group of Siblings in a Flat Hierarchy
Change Text Color to White on Any Non-White Background
Assign CSS Attributes According to Class "Range"
IE9 + Richfaces Rendering Problem
How to Center Block of Inline-Blocks
Highcharts Graph Width Is Incorrect When Scrollbar Is Present, in Bootstrap Fluid Span
How to Collapse Unused Row in a CSS Grid
How to Change Md-Input-Container Placeholder Color Using CSS in Angular Material
Change the Style of an Element If the Fragment Identifier (Hash) in the Url References It
Centering the Navbar Content in Bootstrap 4 (Alpha 5)
Bootstrap 4 - No Column Wrapping
CSS - Font Being Blocked from Cross-Origin Resource Sharing Policy
CSS Min-Height Not Working on Mozilla Firefox
Is There a Functional Difference Between > *:First-Child and > :First-Child
What Is the Current State of the "Scoped" Attribute for the Style Element in HTML5
Why Does the Bootstrap .Row Class Have a Default Margin-Left of -30Px