3 回答
TA贡献1860条经验 获得超8个赞
您还需要注意,引导程序会修改主体{},主要是为了添加字体。因此,当您通过LESS / SASS对其命名空间时,您的输出css文件如下所示:(在引导程序3中)
.bootstrap-styles body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.428571429;
color: #333333;
background-color: white;
}
但很明显,div内不会有body标记,因此您的引导程序内容将没有引导程序字体(因为所有引导程序都从父级继承字体)
要解决此问题,答案应为:
.bootstrap-styles {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.428571429;
color: #333333;
background-color: white;
@import 'bootstrap';
}
TA贡献1821条经验 获得超4个赞
如果将以下内容包含在名为“ bootstrap-namespaced.less”的文件中,则只需将“ bootstrap-namespaced.less”导入到其他文件中文件:
// bootstrap-namespaced.less
// This less file is intended to be imported from other less files.
// Example usage:
// my-custom-namespace {
// import 'bootstrap-namespaced.less';
// }
// Import bootstrap.css (but treat it as a less file) to avoid problems
// with the way Bootstrap is using the parent operator (&).
@import (less) 'bootstrap.css';
// Manually include styles using selectors that will not work when namespaced.
@import 'variables.less';
& {
// From normalize.less
// Previously inside "html {"
// font-family: sans-serif; // Overridden below
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
// Previously inside "body {"
margin: 0;
// From scaffolding.less
// Previously inside "html {"
// font-size: 10px; // Overridden below
-webkit-tap-highlight-color: rgba(0,0,0,0);
// Previously inside "body {"
font-family: @font-family-base;
font-size: @font-size-base;
line-height: @line-height-base;
color: @text-color;
background-color: @body-bg;
}
- 3 回答
- 0 关注
- 530 浏览
添加回答
举报