2

段落全体がページの中央に配置され、左側と右側が完全に整列するように、段落を完全に整列させたいと考えています。以下は、完全に整列された段落の図の例です。 ここに画像の説明を入力

段落は、左右が完全にまっすぐな、ある種のボックスに入っているように見えます。cssまたはhtmlでこれを行うにはどうすればよいですか?

4

5 に答える 5

4

ラッパーには、CSSを介してテキストの位置揃えを適用する必要があります。

text-align:justify;
text-justify:inter-word;

一般に、ブラウザは、印刷用の「植字」アプリケーションと比較して、完全に正当化されたテキストとしてくだらない仕事をします。一般に、ブラウザで完全に正当化すると、テキストが読みにくくなるため、通常は避ける必要があります。

css:

.justify {
    text-align:justify;
    text-justify:inter-word;
}

HTML

<div class="justify"> ...your text...  </div>
于 2012-11-09T20:59:02.753 に答える
0

テキストを正当化するCSS:

style="text-align:justify"
于 2012-11-09T20:59:18.253 に答える
0

さて、単語間の完全な間隔は、テキストを正当化することによって行われます。

p {
    text-align:justify;
    text-justify:inter-word;
} 

ページの中央に段落を配置するには、共通のルール セットが必要です。

p {
    width: auto;
    margin: 0 auto;
}

マージン ルールは、段落の上下のマージンを 0 に設定し (必要に応じてこれを適切な間隔に変更します)、auto は左右のマージンが同じであることを確認します。

于 2012-11-09T21:02:01.220 に答える
0
<html>
<head>
<style>
div
{
text-align:justify;
text-justify:inter-word;
}
</style>
</head>

<body>
<h1>Perfect Box Type Alignment</h1>
<div>I want to perfectly align a paragraph so that the entire paragraph is in the center of the page but the left and right side are perfectly aligned. Here's a picture example of a paragraph that is perfectly aligned:I want to perfectly align a paragraph so that the entire paragraph is in the center of the page but the left and right side are perfectly aligned. Here's a picture example of a paragraph that is perfectly aligned::</div>
</body>

</html>

これがどのように機能するかを確認するには、ブラウザ ウィンドウのサイズを最大に変更してください。

于 2012-11-09T21:18:30.653 に答える
0

あなたの問題を解決するためにこれを試してください:

put STYLE code inside external CSS file or <head><style> Write style code here..</style></head>
.proper_alignment_paragraph_class  
{  
  text-align:justify;  
  text-justify:inter-word;  
}
Put this code inside <body></body> tag.  

<div class="proper_alignment_paragraph_class">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>

于 2017-01-02T16:49:00.093 に答える