Open oobayly opened 3 years ago
Did you fix it?
We have the same issue with Angular 11 and "angular-bootstrap-md": "11.0.0".
Adding min-width: 0!important;
to the body tag in your main css file fixes it.
@42plamusse, min-width: 0!important;
does not work for me
Angular 12 MDBootstrap 11
@Zahen I have very little experience in angular, but I have been through our code and found out that the main style.css is added after the bootstrap one in the angular.json file.
"styles": [
"node_modules/@fortawesome/fontawesome-free/scss/fontawesome.scss",
"node_modules/@fortawesome/fontawesome-free/scss/solid.scss",
"node_modules/@fortawesome/fontawesome-free/scss/regular.scss",
"node_modules/@fortawesome/fontawesome-free/scss/brands.scss",
"node_modules/angular-bootstrap-md/assets/scss/bootstrap/bootstrap.scss",
"node_modules/angular-bootstrap-md/assets/scss/mdb.scss",
"node_modules/animate.css/animate.css",
"node_modules/flag-icon-css/css/flag-icon.min.css",
"node_modules/video.js/dist/video-js.min.css",
"src/styles.scss",
"src/assets/fonts/customfonts.css",
"src/toastr.css"
],
Is there any chance that yours is added before ? The !important
flag could be overwritten by bootstrap's one.
@42plamusse, thank you for your response.
No, I have my styles.scss at the end of the section:
"node_modules/@fortawesome/fontawesome-free/scss/fontawesome.scss",
"node_modules/@fortawesome/fontawesome-free/scss/solid.scss",
"node_modules/@fortawesome/fontawesome-free/scss/regular.scss",
"node_modules/@fortawesome/fontawesome-free/scss/brands.scss",
"node_modules/angular-bootstrap-md/assets/scss/bootstrap/bootstrap.scss",
"node_modules/angular-bootstrap-md/assets/scss/mdb.scss",
"node_modules/animate.css/animate.css",
"node_modules/angular2-toaster/toaster.css",
"node_modules/@ng-select/ng-select/themes/material.theme.css",
"node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css",
"projects/app/src/styles.scss"
I think that this is a problem with Angular 12 compilation....
I have the same problem with Angular 12 and ng-uikit-pro-standard. I have not added the mdb-styles in my angular.json or anywhere else either, but still I get these styles injected into the head tag. Why is that?
The min-width: 0!important;
helped me, but I would rather not have these styles in the head tag at all. Is there a way to get them removed?
@anna-Kop it can be removed with setting inlineCritical: false in angular.json
"optimization": { "scripts": true, "fonts": { "inline": true }, "styles": { "minify": true, "inlineCritical": false } },
This thing was bothering me for so long and I couldn't even find the reason as to why my responeive website loses it's responsiveness on production mode...then I was going through the index.html code to again find out what went wrong and I saw this culprit..I changed it to 134 px then everything satrted working fine
Appologies, for some reason I didn't see the notifiations that there were a bunch of responses to this issue.
@42plamusse - I used your fix, except that I used min-width: initial!important
in the body element which works for me.
Edit: @Lorelei I vaguely remember seeing that fix, but opted for the inline style as I felt I understood that fix better!
I had the same problem with Angular 12 and Bootstrap 4.4.1
To fix it, you only need update Bootstrap to v4.6.2
Same result for me, even with bootstrap 5
When building using
ng build --prod
, or the newng build --configuration production
, astyle
tag is addded to the head element that forces the body min-width to be 992px!important, and completely breaks the responsive layout.In an attempt to identify the culprit, I removed styles from
angular.json
until the min-width wasn't added, and found thatnode_modules/angular-bootstrap-md/assets/scss/bootstrap/bootstrap.scss
was the cause.Expected behavior
The CSS should render the same as when built without the --prod flag.
Actual behavior
The following CSS is injected into the head, breaking the page. Note the
body{min-width:992px!important;}
at the end.Your working environment and MDB version information
Resources (screenshots, code snippets etc.)
package.json