Float image to left and right, then start new paragraph in HTML and CSS

Description

The following code shows how to float image to left and right, then start new paragraph.

Example


<html>
<head>
<title>clear</title>
<style type='text/css'>
img#left {
float: left;
}<!-- w ww. j  a  va  2 s  .c o m-->
img#right {
float: right;
}
p {
clear: both;
margin: 20px 0 0 0;
font: 12px sans-serif;
border: 1px solid rgb(200, 200, 200);
background: rgb(244, 244, 244);
padding: 5px;
}
</style>


</head>
<body>
<img src='http://www.java2s.com/style/download.png' alt='people' id='left' />
<img src='http://www.java2s.com/style/download.png' alt='people' id='right' />
<p>
The clear property cancels the effects of the
float property, and can prevent wrapping from
taking place.
</p>
</body>
</html>

Click to view the demo

The code above generates the following result.

Float image to left and right, then start new paragraph 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...