I am working on my first angular site and i'm trying to create a gradient div which fills the rest of the screen. When I set the height of the grad1
gradient, with px
, it works fine. However, if I use a percentage like 50% or 100%, or just let it set the default height, it results in a height of zero. What could be causing this?
my-component.html
<div id="grad1"></div>
my-component.css
#grad1 {
width: 100%;
background-color: #b0afb4; /* For browsers that do not support gradients */
background-image: linear-gradient(#b0afb4, #fff, #b0afb4); /* Standard syntax (must be last) */
}
app-component.html
<div>
<app-home-display></app-home-display>
</div>
<router-outlet></router-outlet>
app-component.css is empty
index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>MyWebApp</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>
global styles.css
body {
margin: 0;
}