Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How to get text wrapping?  (Read 4883 times)

0 Members and 1 Guest are viewing this topic.

Wuai Bel Ree

    Topic Starter


    Beginner

    How to get text wrapping?
    « on: November 27, 2012, 10:56:15 AM »
    What CSS do I use to get text to wrap around a picture? I put a picture inside a div tag within the main div tag, and now all the text that I'm typing in the outer main div tag appears below the picture.

    kpac

    • Web moderator
    • Moderator


    • Hacker

    • kpac®
    • Thanked: 184
      • Yes
      • Yes
      • Yes
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 7
    Re: How to get text wrapping?
    « Reply #1 on: November 29, 2012, 05:01:02 AM »
    Float the picture either to the left or right.

    Code: [Select]
    img {
       float: left; /* or right */
    }

    papercupmachine



      Greenhorn

      • Paper cup machine
    • Experience: Beginner
    • OS: Windows XP
    Re: How to get text wrapping?
    « Reply #2 on: December 25, 2012, 02:37:31 AM »
    Add the style attribute to your image tag:
    <img src="URL" alt="alternate text" width="width" height="height" style=" />
    You'll use the float style property to move your image to one side or the other. The tricky part is remembering that you're floating your image, not the text. So if you want to wrap the text on the left side of the image, you need to float that image to the right, and vice versa. So add the float property to your image:
    <img src="URL" alt="alternate text" width="width" height="height" style="float:right; />
    If you want your text to wrap around the right of the image, float the image to the left:
    <img src="URL" alt="alternate text" width="width" height="height" style="float:left; />
    Close the style property and upload your HTML to your Web server:
    <img src="URL" alt="alternate text" width="width" height="height" style="float:right;" />
    Using HTML
    Add the align attribute to your image tag:
    <img src="URL" alt="alternate text" width="width" height="height" align=" />
    To wrap text to the left, align the image to the right:
    <img src="URL" alt="alternate text" width="width" height="height" align="right />
    To wrap text to the right, align the image to the left:
    <img src="URL" alt="alternate text" width="width" height="height" align="left />
    Close the align attribute and upload your HTML to the Web server:
    <img src="URL" alt="alternate text" width="width" height="height" align="right" />