Formatting a Selection

Starting with the cursor in the middle of an un-formatted buffer:

Initial Conditions
<div>
····<p>line·one</p>
······<p>line·two</p>
········<p>line·three</p>
····</div>
NORMAL
50%
3:1
 

Enter visual mode:

Enter Visual Mode
<Esc>
<div>
····<p>line·one</p>
······<p>line·two</p>
········<p>line·three</p>
····</div>
NORMAL
50%
3:1
 

Move down another row:

Create the Selection
v
<div>
····<p>line·one</p>
······<p>line·two</p>
········<p>line·three</p>
····</div>
VISUAL
50%
3:1
 

and finally format the selected lines:

Format Selection
j
<div>
····<p>line·one</p>
······<p>line·two</p>
········<p>line·three</p>
····</div>
VISUAL
67%
4:1
 

Note that Vim formatted only the lines contained within the selection (including lines containing the cursors), and didn't touch the other lines.