<code><foreach name="result" item="val" key="i"> <if condition="$i eq 0"> <div class="item active" style="background-image: url(__ROOT__/{$val.pImg1})"> <else></else> <div class="item" style="background-image: url(__ROOT__/{$val.pImg1})"> <div class="container"> <div class="row slide-margin"> <div class="col-sm-6"> <div class="carousel-content"> <h1 class="animation animated-item-1">{$val.pTitle}</h1> </div> </div> <div class="col-sm-6 hidden-xs animation animated-item-4"> <div class="slider-img"> <img src="__ROOT__/%7B%24val.pImg2%7D" class="img-responsive" alt="html5 - thinkphp图片上传到后台,在视图页面显示,样式没变,但是效果却不一样" > </div> </div> </div> </div> </div> <!--/.item--> <p>原图是这样子的</p> <p><img data-src="/img/bVsWvo" alt="html5 - thinkphp图片上传到后台,在视图页面显示,样式没变,但是效果却不一样" ></p> <p>但是在后台传上图片后 在视图显示出来是这样的</p> <p><img data-src="/img/bVsWvv" alt="html5 - thinkphp图片上传到后台,在视图页面显示,样式没变,但是效果却不一样" ><br>请问怎么解决??</p> <h2>回复内容:</h2> <pre class="brush:php;toolbar:false"><code><foreach name="result" item="val" key="i"> <if condition="$i eq 0"> <div class="item active" style="background-image: url(__ROOT__/{$val.pImg1})"> <else></else> <div class="item" style="background-image: url(__ROOT__/{$val.pImg1})"> <div class="container"> <div class="row slide-margin"> <div class="col-sm-6"> <div class="carousel-content"> <h1 class="animation animated-item-1">{$val.pTitle}</h1> </div> </div> <div class="col-sm-6 hidden-xs animation animated-item-4"> <div class="slider-img"> <img src="__ROOT__/%7B%24val.pImg2%7D" class="img-responsive" alt="html5 - thinkphp图片上传到后台,在视图页面显示,样式没变,但是效果却不一样" > </div> </div> </div> </div> </div> <!--/.item--> <p>原图是这样子的</p> <p><img data-src="/img/bVsWvo" alt="html5 - thinkphp图片上传到后台,在视图页面显示,样式没变,但是效果却不一样" ></p> <p>但是在后台传上图片后 在视图显示出来是这样的</p> <p><img data-src="/img/bVsWvv" alt="html5 - thinkphp图片上传到后台,在视图页面显示,样式没变,但是效果却不一样" ><br>请问怎么解决??</p> <p class="answer fmt" data-id="1020000004475971"> </p> <p>与你写的样式定位,图片大小相关。</p> <p class="answer fmt" data-id="1020000004476613"> </p> <p>图片样式写的有问题呗</p> </div></if></foreach></code>