Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Height in percent does not work?

Tags:

html

css

I'm wondering why the height in percentage is not working in this code:

<div style="border-right:1px solid #000; height: 100%;"></div>.

But when I change the height into pixels it works but my problem is the height is fixed in pixels.

Im using this div element as a vertical ruler/separator.

Here's my code: http://jsfiddle.net/jKGUC/5/

Please help. Thanks in advance.

like image 881
NinjaBoy Avatar asked Dec 13 '22 04:12

NinjaBoy


1 Answers

The height: 100%; style sets the height according to the height of the parent container. If the parent is the body, you also need to specify the height on those elements.

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}
like image 88
twaddington Avatar answered Dec 28 '22 20:12

twaddington