3 回答

TA貢獻1860條經(jīng)驗 獲得超8個贊
您還需要注意,引導(dǎo)程序會修改主體{},主要是為了添加字體。因此,當(dāng)您通過LESS / SASS對其命名空間時,您的輸出css文件如下所示:(在引導(dǎo)程序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內(nèi)不會有body標記,因此您的引導(dǎo)程序內(nèi)容將沒有引導(dǎo)程序字體(因為所有引導(dǎo)程序都從父級繼承字體)
要解決此問題,答案應(yīng)為:
.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條經(jīng)驗 獲得超5個贊
如果將以下內(nèi)容包含在名為“ bootstrap-namespaced.less”的文件中,則只需將“ bootstrap-namespaced.less”導(dǎo)入到其他文件中文件:
// 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 關(guān)注
- 562 瀏覽
添加回答
舉報