Search code examples
htmlcssalignment

Aligning text in span which is inside p element


I want to align some text which is enclosed in span which is itself inside a p element. But it is not working.

<p>This line has no alignment.<br /><span class="new">This is right aligned</span></p>

The CSS code is-

.new {text-align: right;}

What is wrong in my CSS code?


Solution

  • p{
    display: inline-block;
    }
    .new{
    float:right;
    }
    

    What exactly are you trying to achieve? Can you give a screenshot of what you want?