php 图像显示检查元素中的0*0像素

8yparm6h  于 2023-05-05  发布在  PHP
关注(0)|答案(2)|浏览(178)

我正在开发一些应用程序,当我在Firefox上运行它时,它工作正常,但当我在Chrome上运行它时,它不会显示所有图像。当我使用inspect element查看元素时,它显示了我的0 x 0像素(自然330*220像素)。下面是我的显示图像的代码

<section id="clients" class="append-bottom">
            <div id="clients-topbar" >  
                <h3 class="append-bottom clear-left clear-right border-left center border" ><i class="icon-group grey_color"></i><span style="font-weight: bold;font-size: 25px; vertical-align: text-bottom;"> Valued Clients</span></h3>
  <marquee behavior="scroll" direction="left" hspace="0">
        <div class="clients-list ">

            <?php 
            foreach($modelClients as $key)
            { ?>   
            <div class="clients-item">
               <?php echo CHtml::image(yii::app()->baseUrl.'/images/clients/'.$key->id.'/'.$key->image,'Parking Media',array('style'=>'width:150px;'));
            ?>
            </div>

               <?php }?>          
              <?php 
            foreach($modelClients as $key)
            { ?>   
            <div class="clients-item">
               <?php echo CHtml::image(yii::app()->baseUrl.'/images/clients/'.$key->id.'/'.$key->image,'Parking Media',array('style'=>' width:150px;'));
            ?>
            </div>

               <?php }?>  
              <?php 
            foreach($modelClients as $key)
            { ?>   
            <div class="clients-item">
               <?php echo CHtml::image(yii::app()->baseUrl.'/images/clients/'.$key->id.'/'.$key->image,'Parking Media',array('style'=>' width:150px;'));
            ?>
            </div>

               <?php }?>  
              <?php 
            foreach($modelClients as $key)
            { ?>   
            <div class="clients-item">
               <?php echo CHtml::image(yii::app()->baseUrl.'/images/clients/'.$key->id.'/'.$key->image,'Parking Media',array('style'=>' width:150px;'));
            ?>
            </div>

               <?php }?>  
              <?php 
            foreach($modelClients as $key)
            { ?>   
            <div class="clients-item">
               <?php echo CHtml::image(yii::app()->baseUrl.'/images/clients/'.$key->id.'/'.$key->image,'Parking Media',array('style'=>' width:150px;'));
            ?>
            </div>

               <?php }?>  
        </div>

        </marquee>
    </div>
</section>

我看到了这个链接Image in tag is defaulting to 0 x 0 pixels despite setting its size,但无法解决这个问题。

编辑:

<section id="clients" class="append-bottom">
        <div id="clients-topbar">  
            <h3 class="append-bottom clear-left clear-right border-left center border"><i class="icon-group grey_color"></i><span style="font-weight: bold;font-size: 25px; vertical-align: text-bottom;"> Valued Clients</span></h3>
            <marquee behavior="scroll" direction="left" hspace="0">
            <div class="clients-list  crum_start_animation">

                <div class="clients-item">
                   <img style="width:150px;" src="/allSpice_falak/images/clients/7/America.jpg" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style="width:150px;" src="/allSpice_falak/images/clients/8/Uk.jpg" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style="width:150px;" src="/allSpice_falak/images/clients/9/germany.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style="width:150px;" src="/allSpice_falak/images/clients/10/russia.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style="width:150px;" src="/allSpice_falak/images/clients/11/spain.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style="width:150px;" src="/allSpice_falak/images/clients/12/italy.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style="width:150px;" src="/allSpice_falak/images/clients/13/greece.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style="width:150px;" src="/allSpice_falak/images/clients/14/hungary.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style="width:150px;" src="/allSpice_falak/images/clients/15/norway.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style="width:150px;" src="/allSpice_falak/images/clients/16/sweden.png" alt="Parking Media" class="crum_start_animation">                </div>


                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/7/America.jpg" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/8/Uk.jpg" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/9/germany.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/10/russia.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/11/spain.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/12/italy.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/13/greece.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/14/hungary.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/15/norway.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/16/sweden.png" alt="Parking Media" class="crum_start_animation">                </div>


                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/7/America.jpg" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/8/Uk.jpg" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/9/germany.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/10/russia.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/11/spain.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/12/italy.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/13/greece.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/14/hungary.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/15/norway.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/16/sweden.png" alt="Parking Media" class="crum_start_animation">                </div>


                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/7/America.jpg" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/8/Uk.jpg" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/9/germany.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/10/russia.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/11/spain.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/12/italy.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/13/greece.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/14/hungary.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/15/norway.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/16/sweden.png" alt="Parking Media" class="crum_start_animation">                </div>


                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/7/America.jpg" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/8/Uk.jpg" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/9/germany.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/10/russia.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/11/spain.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/12/italy.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/13/greece.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/14/hungary.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/15/norway.png" alt="Parking Media" class="crum_start_animation">                </div>

                <div class="clients-item">
                   <img style=" width:150px;" src="/allSpice_falak/images/clients/16/sweden.png" alt="Parking Media" class="crum_start_animation">                </div>

            </div>

            </marquee>
        </div>
    </section>
7y4bm7vi

7y4bm7vi1#

哦,我现在明白你是如何使用<Marquee>标签的了(不知道在所有事情之后,每个人都使用jQuery:D)。
但修复似乎是从你的css文件中的img{}中删除max-width:100%,我为我修复了它。不知道为什么btw!:D

tjvv9vkg

tjvv9vkg2#

我知道这已经有一段时间了,因为这是张贴,但我遇到了同样的问题,这为我修复了它。
添加所需的宽度大小作为最大宽度,并将图像元素的宽度设置为100%;

img{
  max-width: 150px;
  width: 100%;
}

相关问题