Html 是否可以在引导程序框架内对齐文本?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19144644/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is it possible to justify text within the bootstrap framework?
提问by scriptmonkey
This might be a silly question but I'm certain I'm not the only one wondering.
这可能是一个愚蠢的问题,但我确信我不是唯一想知道的人。
I'm aware of the alignment classes:
<p class="text-center">Text Centered within the block element</p>
<p class="text-right">Text aligned to the right within the block element</p>
<p class="text-left">Text aligned to the left within the block element</p>
我知道对齐类:
<p class="text-center">Text Centered within the block element</p>
<p class="text-right">Text aligned to the right within the block element</p>
<p class="text-left">Text aligned to the left within the block element</p>
Is there a set of classes in Twitters Bootstrap Framework that justifies text?
Twitters Bootstrap 框架中是否有一组类来证明文本的合理性?
e.g. <p class="text-justify">Sample Text Goes Here</p>
例如 <p class="text-justify">Sample Text Goes Here</p>
why does it appear that bootstrap do not incorporate a utility function such as text-align: justify
?
为什么 bootstrap 似乎没有包含诸如text-align: justify
?
回答by Zoltan
In Bootstrap 3 and Bootstrap 4 you can use the following:
在 Bootstrap 3 和 Bootstrap 4 中,您可以使用以下内容:
<p class="text-justify">Justified text.</p>
回答by Flavio Paulino
No. But you can add a new class on bootstrap.css
不。但是你可以在bootstrap.css上添加一个新类
.text-justify {
text-align: justify;
}
Update
更新
Previous versions of bootstrap was not supporting text-justify
.
But bootstrap 3 has added a class text-justify
.
以前版本的引导程序不支持text-justify
. 但是 bootstrap 3 添加了一个类text-justify
。
回答by chris Frisina
You can add to your main.css
, custom.css
, or whichever *.css
file you have made, or to the top of bootstrap.css
file directly:
您可以添加到您的main.css
,custom.css
或*.css
您制作的任何文件,或bootstrap.css
直接添加到文件顶部:
.text-justify {
text-align: justify;
}
If you add this to the bootstrap.css
file direcetly, as of v3.0.0, it would go from this:
如果直接将其添加到bootstrap.css
文件中,从 v3.0.0 开始,它将从以下位置开始:
/*!
* Bootstrap v3.0.0
*
* Copyright 2013 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world by @mdo and @fat.
*/
/*! normalize.css v2.1.0 | MIT License | git.io/normalize */
article,
aside,
details,
...
...
…
to
到
/*!
* Bootstrap v3.0.0
*
* Copyright 2013 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world by @mdo and @fat.
*/
/*! normalize.css v2.1.0 | MIT License | git.io/normalize */
.text-justify {
text-align: justify;
}
article,
aside,
details,
...
...
…