Right-align block elements in HTML

后端 未结 8 864
故里飘歌
故里飘歌 2021-02-06 23:53

I\'d like to right-align block elements in a floating container.

Assume the following markup.

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-07 00:32

    I know you don't want to edit the HTML.. but if you want images to be in block why don't just put them in one :D!

    HTML

        

    This is crap station train to the mainstream...

    jesus was not

    mum asked me to

    This is crap station train to the mainstream...

    CSS

    .sth{display:block; text-align:right;}
    .sth img{ 
    border: 1px solid black;
    }
    

    DEMO: http://jsfiddle.net/goodfriend/zBnqQ/39/

提交回复
热议问题