문제

I have a simple p but I am not able to justify it. I centered it but don't know how to justify?

HTML:

<p>This is about meThis is about meThis is about meThis is about meThis is about meThis is about meThis is about meThis is about meThis is about meThis is about me</p>

CSS:

p{
    text-align: justify;
    margin: 0 auto;
}

Fiddle.

I checked out this post but it didn't helped! :(

도움이 되었습니까?

해결책 2

Mohammed,

It looks like your last CSS, you have the text-align set to 'center'. If you are looking to have it full justified, you want it to look like this:

.major_data .about p:nth-child(2){
    text-align: justify;
}

Basically, the available options for text-align are:

  • Left
  • Right
  • Center
  • Justify

Center is what you were using before, which is why your text was centered. Justify is the equivalent "full" in Word or something, which I believe is what you are looking for.

다른 팁

see this one DEMO

.major_data .about p:nth-child(2){
text-align: justify;
 }

So after searching an hour I got a simple solution. I was after the p to get in centered of the div and get it justified. All of you thanks for your answers!

Here's the solution: Fiddle.

.major_data .about p:nth-child(2){
    text-align: justify;
    width: 80%;
    margin: 0 auto;
    margin-bottom: 20px;
}

We just need some width set the margin: 0 auto; and get the p into the center of the div.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top