How do I put text that is inside a P element next to a image?

前端 未结 4 1047
感情败类
感情败类 2021-01-19 23:58

Here is my code:


This is some example text that i want next to th

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-20 00:28

    If you want to place text to right side of an image, here's code which will allow it:

       

    img Image text here.

    Running example: https://jsfiddle.net/apc5spcu/

    Alternately, you could use divs and make a nicer looking image form.

    HTML

    img

    Image text here.

    Image text here.

    Image text here.

    Image text here.

    This code makes use of 'Float' which positions each division next to eachother on left and right sides.

    CSS

    .container {
        width:540px;
    }
    .imgdiv {
        float:left;
        width:140px;
    }
    .textdiv {
        float:right;
        width:300px;
    }
    

    Running example: https://jsfiddle.net/apc5spcu/1/

提交回复
热议问题