How to Use DIV Tags to Float Photos Online

The HTML "Align" attribute is deprecated, which means you should use the "Style" attribute instead, whenever possible. One way to use the style attribute is to use it along with the "Float" attribute in a DIV element. You can use the float attribute to float a DIV element to the right or left. You can then enclose an image inside the DIV to make it align with the element.

Instructions

    • 1

      Input the opening DIV "style" tag to indicate a styled DIV element, then use the float element to float it:

      <div style="float: left">

    • 2

      Type the code to produce the image:

      <div style="float: left"><img src="http://www.image-URL-here" />

    • 3

      Close the DIV element by adding the closing tag:

      <div style="float: left"><img src="http://www.image-URL-here" /></div>

    • 4

      Replace "image-URL-here" with the image's Web address. Replace "float: left" with "float: right" if you want to float the image to the right instead.

Related Searches:

Comments

Related Ads

Featured