How to add automatic class in image for wordpress post

后端 未结 12 1512
时光说笑
时光说笑 2020-12-02 13:53

I want to make a responsive theme with Bootstrap 3. However, I need to automatically add the CSS class .img-responsive to every post image because I need the i

12条回答
  •  天涯浪人
    2020-12-02 14:32

    I think the easiest way is to use CSS like this.

    .content img { height: auto; max-width: 100%; }
    

    Where .content is the area that contains your post content.

    Note: You may also want to override the .wp-caption class as well like so.

    .wp-caption { width: auto !important; }
    

提交回复
热议问题