-2
I have an element <aside>
, and I want him to occupy all the height of <div>
where it is inserted. However, I don’t know how to set the height relative to another element. How can I set the height of the element <aside>
in relation to parent element properties, with CSS?
I’m using Materialize CSS
to make the styling and adjustment grid.
GIFT
<body>
<header>
<!-- cabeçalho -->
</header>
<div class="row">
<aside class="white black-text col s3">
<ul>
<li>item</li>
<li>item</li>
<li>item</li>
<li>item</li>
<li>item</li>
<li>item</li>
<li>item</li>
<li>item</li>
<li>item</li>
<li>item</li>
</ul>
</aside>
<div class="col s9">
<!-- demais conteúdo -->
</div>
</div>
</body>
CSS
aside{
padding: 2em;
width: 25em;
/* elemento "height" ocupa apenas a área padrão do elemento, e não 100% da altura da div, como queria */
height: 100%;
}
Desired result:
Result obtained so far:
uses bootstrap 4 olha ai q facil https://getbootstrap.com/docs/4.0/utilities/sizing/
– Jasar Orion
You also need to think about the following:
<div>
is a container that has the size necessary to fit your content. So if you want the<aside>
has the size of 100% of<div>
you already have it, because the<div>
adapts to the size of your<aside>
. :D– fernandosavio
But that being said, this part is layout, so you should probably use something like CSS Grid or Flex Box
– fernandosavio