18910140161

JavaScript-Angular 12-更新后在styles.CSS(bootstrap?)之前插入的CSS样式块正在破坏响应-堆栈溢出

顺晟科技

2022-10-18 13:18:17

167

在从11

升级到Angular 12(12.2.1)后,我在样式表链接

之前得到了一个注入的样式块。
<代码><;样式>;@字符集";UTF-8";@导入URL(https://fonts.googleapis.com/css?family=open+sans);:根{--蓝色:#007BFF;一堆颜色变量。线高:1.5;颜色:#212529;文本对齐:左;背景色:#fff;}IMG{border-style:none;}IMG{vertical-align:middle;}IMG{page-break-inside:avoid;}@页面{大小:A3;}正文{最小宽度:992px!重要;}<;/样式>;<;link rel=";样式表";href=";styles.645853d3825cd77dedab.CSS";媒体=打印onload=";this.media=' all '";>;<;noscript>;<;link rel=";stylesheet";href=";样式.645853d3825cd77dedab.CSS";>;<;/noscript>;<;/标题>;

最后一行(正文)破坏了我的页面的响应性。

这只在NG Build上,它不会在NG Serve上本地出现。我不知道它是从哪里来的,也不知道是哪个模块负责注入的。我正在使用NG-Bootstrap 10,但将其降级到以前的版本不会影响上面的代码块。


顺晟科技:

固定与答案在这里:https://stackoverflow.com/a/67582075/382281.

只需将<style> @charset "UTF-8";@import url(https://fonts.googleapis.com/css?family=Open+Sans); :root{ --blue:#007bff; --a bunch of color variables -- line-height:1.5;color:#212529; text-align:left;background-color:#fff;} img{border-style:none;} img{vertical-align:middle;} img{page-break-inside:avoid;} @page {size:a3;} body{min-width:992px!important;} </style> <link rel="stylesheet" href="styles.645853d3825cd77dedab.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.645853d3825cd77dedab.css"></noscript> </head> 添加到特定构建的angular.JSON文件中。

<代码>";优化";:{";脚本";:true,";样式";:{";缩小";:true,";内嵌关键";:假}},
  • TAG:
相关文章
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航