Float a paragraph right and make text above and under clear in HTML and CSS

Description

The following code shows how to float a paragraph right and make text above and under clear.

Example


<!--  ww  w . j  a  v a 2 s . c  om-->
<html>
<head>
<style type="text/css">
p.aligned-right {
border-style: solid;
border-width: 1px;
height: 100px;
width: 100px;
background-color: yellow;
float: right;
}

.clearright {
clear: right;
}
</style>


</head>
<body>
<div class="content">
<div>
This is some dummy text.
<p class="aligned-right">A floating region</p>
Here is some more text. <br class="clearright" /> This text should
appear after the floating section.
</div>
</div>
</body>
</html>

Click to view the demo

The code above generates the following result.

Float a paragraph right and make text above and under clear in HTML and CSS
Home »
  HTML CSS Tutorial »
    Text »
      Paragraph
HTML CSS Tutorial Paragraph
Add line break to a paragraph in HTML and C...
Add margin to paragraph in HTML and CSS
Add shading border for paragraph in HTML an...
Create Paragraphs in HTML and CSS
Create three Paragraphs in HTML and CSS
Demonstrate White Space Collapsing and Line...
Float a paragraph right and make text above...
Float image to left and right, then start n...
Float paragraph in HTML and CSS
Set text align for paragraph to center in H...
Use different border style to highlight wor...
Use margin to align and move a paragraph in...