on-internet
← Community

"float:right" makes text appear under div instead of inside it

Stack Overflow ·

I have a <div> which contains a line of text: <div class="story" style="width:400px;"> <p> This text should appear inside the box. </p> </div> <div class="story" style="width:400px;"> <p> This text should appear inside the box. </p> </div> This works as expected as can be seen in the following screenshot: But when I try and float the text right it appears under the <div>: <div class="story" style="width:400px;"> <p style="float:right;"> This text should appear inside the box. </p> </div> <div class="story" style="width:400px;"> <p> This text should appear inside the box. </p> </div> Screenshot

Comments

Sign in or sign up to comment and upvote.

No comments yet.