How can I wrap text around a bottom-right div?

后端 未结 7 1409
难免孤独
难免孤独 2020-11-22 11:30

Every time I try to do something seemingly-simple in CSS, it doesn\'t work.

I have a content div that contains a 460x160 image. All I want to do is position the imag

7条回答
  •  不思量自难忘°
    2020-11-22 12:01

    The simplest solution i found is to wrap img inside a div element and then use padding-top and margin-bottom values to align it.

    This is my CSS

    .contentDiv  .bottomRight img{
      height: 130px;
      float:right;
      padding-top: 60px;
      margin-bottom: -10px;
      }
    

    and here is the HTML

    If you are seeing this and reading it, then all is working well.

    The reason padding and margin worked for me is because I use it inside the parent element "contentDiv" to auto adjust height of the div according to the content. Not sure if its of any use.

提交回复
热议问题