div 100% height - CSS

0

How can I leave my column at 100% height?

example:

EXAMPLE

where Teste is written, it is the column that has to be 100% height,

DETAIL

On some screens, I will add content using jQuery , I also need to not leave this content that is not yet visible outside the height

CODE

    <div class="col-xs-12 col-md-12" id="menu">
    <nav class="navbar navbar-default">
        <div class="container-fluid">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#">Brand</a>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                  <li><a href="index.html"><span class="glyphicon glyphicon-envelope"></span> Item</a></li>
                  <li><a href="index.html"><span class="glyphicon glyphicon-shopping-cart"></span> Item</a></li>
                  <li><a href="index.html"><span class="glyphicon glyphicon-list"></span> Item</a></li>
                  <li><a href="index.html"><span class="glyphicon glyphicon-signal"></span> Item</a></li>
                  <li><a href="index.html"><span class="glyphicon glyphicon-cog"></span> Item</a></li>
                </ul>
<ul class="nav navbar-nav navbar-right">
    <li><a href="#">Log off</a></li>
</ul>
            </div><!-- /.navbar-collapse -->
        </div><!-- /.container-fluid -->
    </nav>
</div>

<div class="col-xs-12 col-md-2" id="ulMenuLateral">
    <ul>
        <li><a href="index.html"><span class="glyphicon glyphicon-envelope"></span> Item</a></li>
        <li><a href="index.html"><span class="glyphicon glyphicon-shopping-cart"></span> Item</a></li>
        <li><a href="index.html"><span class="glyphicon glyphicon-list"></span> Item</a></li>
        <li><a href="index.html"><span class="glyphicon glyphicon-signal"></span> Item</a></li>
        <li><a href="index.html"><span class="glyphicon glyphicon-cog"></span> Item</a></li>
    </ul>
</div>


<div class="col-xs-12 col-md-10 content">
  <div class="col-xs-12 col-md-12 semPadding paddingCimaBaixo">
    <h1>
      Teste
    </h1>
  </div>

    
asked by anonymous 03.12.2015 / 17:30

2 answers

3

Let's start from the easiest and let's get down to the trickiest. To make content visible, you need to add overflow: scroll to the column.

As for height: 100% which is the most complicated part of it. You need to declare a reference size that is the parent of the node. This is an old CSS problem where you can not change the size without having a reference. Something like body: 600px .

With CSS3 added an alternative called view height and view width . With it you get 100% on any device, but you have some compatibility issues. The media only exists for IE9 + and there is no support for Opera mini. You can check the list here.

And follow the class example.

.content {
    height: 100vh;
    overflow: scroll;
}
    
03.12.2015 / 17:47
1

In addition to the alternative mentioned above by @flpms it is possible to find out the screen size, and by means of jquery implement in your css this time.

var altura = $(window).height();
$(".coluna").css("height",altura);

So by passing the height of your screen to the column, so always having 100%.

    
03.12.2015 / 17:51