Greg
Greg

Reputation: 3063

How to right-align text in a div with text-align "justify"

I'd like the last sentence of my text to be right-aligned (the rest of the text is justified).

I tried the <span> below in the middle of a <p> tag but without success:

span.activity-conclusion
{
    font:22px 'Open Sans', "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
    font-weight:200;
    text-align:right;
    color:#467FD9;
}

And that's the CSS code of the <div> where the text is:

#activity-right { 
    font:12px 'Open Sans', "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
    font-weight:400;
    padding-left:25px;
    padding-top:20px;
    height: 100%;
    color:#000;
    width: 60%; 
    float: left;
    position: relative; 
    text-align:justify;
    border-left: 1px dotted #666;
    -moz-column-count: 1;
    -moz-column-gap: 1.5em;
    -moz-column-rule: 1px solid #c4c8cc;
    -webkit-column-count: 1;
    -webkit-column-gap: 1.5em;
    -webkit-column-rule: 1px solid #c4c8cc;
}

Upvotes: 0

Views: 258

Answers (3)

kiranvj
kiranvj

Reputation: 34107

Give dir attribute to the p tag and give the value rtl

Eg:

<p dir="rtl"> Your text here </p>

Check a demo here http://jsfiddle.net/ALaVv/1/

Upvotes: 0

ephemient
ephemient

Reputation: 204698

text-align: justify;
text-align-last: right;

text-align-last is part of CSS3, and works in Firefox and IE... unfortunately, not yet in WebKit.

Upvotes: 2

Andy
Andy

Reputation: 14575

Set an id to the <p> that you want to affect and use text-align: right;

Upvotes: 0

Related Questions