html - Angular won't load styles.css -
i'm building simple angular app bootstrap. seems base index.html won't load styles.css. if put css code right html tags works charm. tried reboot app , clear browser cache, seems ignore style file. when wrote css file first time worked, hence thought cache problem. changed nothing of angular project base structure.
here's code.
index.html
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>reagapp</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> <div class="container"> <app-root></app-root> </div> </body> </html> styles.css
body { background-color: #d9d9d9; } .container{ width: 70%; max-width: 100%; background-color: white; margin-left: auto; margin-right: auto; } here's version works instead.
index.html
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>reagapp</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 style=" background-color: #d9d9d9;"> <div class="container" style="width: 70%; max-width: 100%; background-color: white; margin-left: auto; margin-right: auto;"> <app-root></app-root> </div> </body> </html> .angular-cli.json
[other things] "prefix": "app", "styles": [ "styles.css", "../node_modules/bootstrap/dist/css/bootstrap.min.css", "../node_modules/font-awesome/css/font-awesome.css" ], "scripts": [ "../node_modules/jquery/dist/jquery.min.js", "../node_modules/tether/dist/js/tether.min.js", "../node_modules/bootstrap/dist/js/bootstrap.min.js" ], "environmentsource": "environments/environment.ts", [other things] the code pretty trivial still.
in advance.
you need reference stylesheet in yout .angular-cli.json :
"styles": [ "path/to/style.css" ],
Comments
Post a Comment