Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 在Angular应用程序中覆盖Boostrap_Css_Angularjs_Twitter Bootstrap - Fatal编程技术网

Css 在Angular应用程序中覆盖Boostrap

Css 在Angular应用程序中覆盖Boostrap,css,angularjs,twitter-bootstrap,Css,Angularjs,Twitter Bootstrap,我正在尝试覆盖Angular应用程序中的默认Twitter引导样式。我正在使用AngularJSV1.6.8 我的文件结构如下所示: *src *应用程序 *公开的 *风格 *global-styles.css *index.html 我已经在global-styles.css中放置了我想用来覆盖Twitter引导样式的css 目前,我使用“bootstrap css only”来利用Twitter bootstrap提供的默认样式 我在index.html中添加了我的global-styles

我正在尝试覆盖Angular应用程序中的默认Twitter引导样式。我正在使用AngularJSV1.6.8

我的文件结构如下所示:

*src
*应用程序
*公开的
*风格
*global-styles.css
*index.html

我已经在global-styles.css中放置了我想用来覆盖Twitter引导样式的css

目前,我使用“bootstrap css only”来利用Twitter bootstrap提供的默认样式

我在index.html中添加了我的global-styles.css,如下所示:


我的自定义样式不会显示在我的index.html和/或任何组件上。有什么想法吗


多谢各位

无论您想要覆盖哪些新的CSS类,都必须在style.CSS文件中保留这些CSS类。我会工作,只是添加!在CSS类属性中很重要。
.

无论您想要覆盖哪些新的CSS类,都必须在style.CSS文件中保留这些CSS类。我会工作,只是添加!在CSS类属性中很重要。
.

这是因为base href设置为“/”,无法完全加载css。 您可以删除基本标记并使用相对路径:

<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles/global-styles.css">

或设置绝对路径:

<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="/">
<link rel="stylesheet" href="ROOT_PATH/src/public/styles/global-styles.css">


注意:您需要替换ROOT_PATH,这是因为base href设置为“/”并且无法完全加载css。 您可以删除基本标记并使用相对路径:

<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles/global-styles.css">

或设置绝对路径:

<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="/">
<link rel="stylesheet" href="ROOT_PATH/src/public/styles/global-styles.css">


注意:您需要替换根路径

我不想使用!在我的CSS中很重要。在这种情况下,我更希望能够通过加载文件的顺序,将定制CSS覆盖基线Twitter引导CSS的CSS文件放在这里。我无法理解,因为基线引导CSS仅来自引导CSS。我宁愿不使用!在我的CSS中很重要。在这种情况下,我更希望能够通过加载文件的顺序,将定制CSS覆盖基线Twitter引导CSS的CSS文件放在这里。我无法理解这一点,因为基线引导CSS仅来自引导CSS。