Align text to the right of an image && text doesn't wrap around the image

前端 未结 2 1891
独厮守ぢ
独厮守ぢ 2021-02-14 02:46

Should look like this:

[img] text text
      text text

How is this accomplished?

Seems straight forward, but I\'m struggling.

2条回答
  •  别那么骄傲
    2021-02-14 03:14

    Since you know the dimensions of the image:

    HTML:

    CSS:

    #theimg{
        position: absolute;
        top: 50%;
        margin-top: -50px; // Half the width of the image
        width: 100px;
        height: 100px;
    }
    
    #besidetheimg{
        margin-left: 100px; // width of image
    }
    

    It's a bit of a weird way to do it. I'm not sure if there is a better way though, and it works: http://jsfiddle.net/dvLqC/

提交回复
热议问题