不确定这是否可行。我认为Twitter Bootstrap标题太大了。 h1
是36px
; h2
是30px
,依此类推。按比例降低twitter引导标题大小
有没有什么办法可以按比例缩小标题大小?假设我只想每个标题的90%。我不想一一列出每个标题的字体大小。
谢谢。
不确定这是否可行。我认为Twitter Bootstrap标题太大了。 h1
是36px
; h2
是30px
,依此类推。按比例降低twitter引导标题大小
有没有什么办法可以按比例缩小标题大小?假设我只想每个标题的90%。我不想一一列出每个标题的字体大小。
谢谢。
给一个类的body
,让这个CSS:
body.myClass h1,
body.myClass h2,
body.myClass h3,
body.myClass h4,
body.myClass h5,
body.myClass h6 {font-size: 0.9em;}
这给你90%的原始大小。你也可以把它作为90%
。 :)
这将是很好,如果这是可能的调整一个变量在LESS,但我不认为它是。
// Typography
// -------------------------
@sansFontFamily: "Helvetica Neue", Helvetica, Arial, sans-serif;
@serifFontFamily: Georgia, "Times New Roman", Times, serif;
@monoFontFamily: Monaco, Menlo, Consolas, "Courier New", monospace;
@baseFontSize: 14px;
@baseFontFamily: @sansFontFamily;
@baseLineHeight: 20px;
@altFontFamily: @serifFontFamily;
@headingsFontFamily: inherit; // empty to use BS default, @baseFontFamily
@headingsFontWeight: bold; // instead of browser default, bold
@headingsColor: inherit; // empty to use BS default, @textColor
所以,你可以通过改变@baseFontSize
规模文本的所有,但遗憾的是没有单独的@baseHeaderFontSize
。你总是可以分解这个项目!
编辑2:正如@merv指出的,标题大小将基于@baseFontSize
from 2.1.2。
原创编辑:实际上,它看起来像标题大小反正硬编码:type.less:
h1 { font-size: 36px; line-height: 40px; }
h2 { font-size: 30px; line-height: 40px; }
h3 { font-size: 24px; line-height: 40px; }
h4 { font-size: 18px; line-height: 20px; }
h5 { font-size: 14px; line-height: 20px; }
h6 { font-size: 12px; line-height: 20px; }
我猜OP是使用纯CSS。 :) –
然后他应该切换到LESS。 :) – RichardTowers
事实上,即使在普通的CSS,如果这是一个变量OP可以建立一个[自定义引导](http://twitter.github.com/bootstrap/customize.html#variables)与变量设置为他们希望。这不是一个变量。 – RichardTowers
我意识到这线程现在已经过去18个月大,但万一有人遇到此同样,引导(V3.1.1)的最新版本拥有所有标题的字体大小的设置less/variables.less
,就像这样:
@font-size-h1: floor((@font-size-base * 2.6)); // ~36px
@font-size-h2: floor((@font-size-base * 2.15)); // ~30px
@font-size-h3: ceil((@font-size-base * 1.7)); // ~24px
@font-size-h4: ceil((@font-size-base * 1.25)); // ~18px
@font-size-h5: @font-size-base;
@font-size-h6: ceil((@font-size-base * 0.85)); // ~12px
所以它只是调整的乘数为每这些有的情况下,一个影响。
'解决方案:'用单个支架替换双托架。这是我认为的一个错误。 –
@ B.Martin上面的代码是bootstrap less/variables.less文件中的代码片段,并非我写的代码。即使在最新版本v3.3.6(非sass)中,代码也是一样的。 – alexkb
我相信引导程序会设置一个baseFontSize变量,几乎所有的字体大小属性都是相对的,例如:font-size:@baseFontSize * 2;你可以把它改成更小的东西。 – Mark