【问题标题】:Inline css background image not working内联css背景图像不起作用
【发布时间】:2016-05-23 14:18:43
【问题描述】:

这是我正在使用的代码

<div class="item active" style="background-image: url('https://this is url/urlwebsite.com/images/sliderbg1.jpg');">

帮我看看问题出在哪里

【问题讨论】:

  • 你的图片文件夹在哪里?
  • 指定DIV元素的高度

标签: php css codeigniter


【解决方案1】:

该图像应该出现。这是示例

<div style="background-image:url(http://webneel.com/wallpaper/sites/default/files/images/01-2014/7-flower-wallpaper.jpg)">

小提琴 - https://jsfiddle.net/gLbn4dLm/

编辑:您尚未指定该 DIV 元素的高度。请指定该 DIV 元素的高度。

【讨论】:

    【解决方案2】:

    试试base_url()

    <div class="item active" style="background-image: url('<?php echo base_url() ;?>images/sliderbg1.jpg');">
    

    确保您的 images 文件夹位于项目的根目录(外部应用程序文件夹)中。

    【讨论】:

      猜你喜欢
      • 2016-09-27
      • 1970-01-01
      • 2016-02-14
      • 1970-01-01
      • 1970-01-01
      • 2017-02-19
      • 2018-03-22
      • 2013-06-26
      相关资源
      最近更新 更多