#
#
#yamynginx2020-01-23 21:57:25
css
#yamynginx, 2020-01-23 21:57:25

How to set block height to viewport height?

Hey!
I have two problems:
1) UIKit 3 has .uk-height-viewport- https://asuikit.com/v3/height
I apply it like this:

<div class="uk-width-1-2 uk-overflow-auto uk-height-viewport">

But you can do it like this:
<div class="uk-width-1-2 uk-overflow-auto" uk-height-viewport>

The second option doesn't work at all.
In CSS I did this (replaced 100vh with 90vh):
.uk-height-viewport {
  max-height: 90vh;
}

And then a dilemma arose, 100 vh - went below the viewport resolution , and 90 - just right. But only for my monitor (1920x1080).
How can I make the width adaptive to the entire viewport (for me it is probably +- 980 px. In other words, the window where the entire site is placed)?
2) I made a grid via uk-grid :
<div class="uk-flex-center" uk-grid>
  <div class="uk-width-1-2 uk-overflow-auto uk-height-viewport">

Here is a screenshot-layout:
5e29ec598491d639313750.png
According to the standard, these two blocks go in the center:
The left block goes a little to the left, and the right one - a little to the right. But I would like exactly the same as in the screenshot: the left block goes strictly in the center, and the right block goes to the right of the central one. How to do this? Double grid?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2020-01-24
@muxui

I throw off a couple of examples as an answer to item 2, but I think here is the solution to item 1 at the same time, for which I did not see the code.
Option one:
..
second nested.
to understand the first line and the essence was taken from the question itself
..
The width of the blocks can be changed. there should be no questions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question