css设置最大宽度 img{ max- 143px; expression(this.width > 143 ? "143px" : this.width);} 这种方法可以直接写在css上,不用写在js上