如何使用 CSS 设置为我的
  • 如果我使用 Zend 框架,背景是什么?
  • 发布于 2024-08-23 04:17:24 字数 742 浏览 1 评论 0原文

    其他一切都 100% 有效,所以我 100% 肯定错误出在我用于图像的文件路径中。

    图像无法加载。

    A

    ) 我需要该文件出现在 Zend 工作区中,我该怎么做。

    B) 我的道路是错误的。

    这是我的文件层次结构:

    alt text

    这是我的 CSS 代码:

    #nav-menu li{
        float: left;
        margin: 0 0.15em;
    } 
    
    #nav-menu li a:HOVER{
        background-color: yellow;
    }
    
    #nav-menu li a{
        background: url(./img/buttonbackground.jpg) #fff bottom left repeat-x;
        height: 2em;
        line-height: 2em;
        float: left;
        width: 9em;
        display: block;
        border: 0.1em solid #dcdce9;
        color: #0d2474;
        text-decoration: none;
        text-align: center; 
    } 
    

    我向你保证,图像实际上就在那里,在我的光盘中,但我猜路径是错误的。

    Everything else 100% works, so I'm 100% positive the error lies in the file path I'm using for the image.

    The image doesn't load.

    Either

    A) I need the file to appear in the Zend workspace, how do I do that.

    or

    B) My path is wrong.

    Here's my file heirarchy:

    alt text

    And here's my CSS code:

    #nav-menu li{
        float: left;
        margin: 0 0.15em;
    } 
    
    #nav-menu li a:HOVER{
        background-color: yellow;
    }
    
    #nav-menu li a{
        background: url(./img/buttonbackground.jpg) #fff bottom left repeat-x;
        height: 2em;
        line-height: 2em;
        float: left;
        width: 9em;
        display: block;
        border: 0.1em solid #dcdce9;
        color: #0d2474;
        text-decoration: none;
        text-align: center; 
    } 
    

    I assure you, the image IS physically there, in my disc, but the path is wrong I guess.

    如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

    扫码二维码加入Web技术交流群

    发布评论

    需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

    评论(3

    原来是傀儡 2024-08-30 04:17:24

    相对路径必须是相对于css文件的,如果您发布的代码位于该CSS文件夹中,则需要:

    background: url(../img/buttonbackground.jpg) #fff bottom left repeat-x;
    

    A relative path must be relative to the css file, if the code you posted is in that CSS folder, you need:

    background: url(../img/buttonbackground.jpg) #fff bottom left repeat-x;
    
    §对你不离不弃 2024-08-30 04:17:24

    前导 . 使图像 url 相对于 html 文件的 url。删除 . 将使路径成为主机的绝对路径。

    值得注意的是,Zend Framework 使用 url 重写将所有未映射到文件的 url 路由到 index.php

    The leading . is making the image url relative to the url of the html file. Removing the . will make the path absolute to the host.

    It's worth noting that the Zend Framework uses url rewriting to route all urls which don't map to a file to index.php.

    断肠人 2024-08-30 04:17:24

    我也遇到过这个问题,但不记得我做了什么来解决它。

    尝试找到描绘一个向下的小三角形的图标(文件浏览器的顶部)。它是最右侧的图标,带有标记为“查看菜单”的工具提示。单击它并选择过滤器。检查是否存在可能导致文件不可见的过滤器。如果这没有帮助,请尝试转换视角。另请尝试右键单击该文件夹并选择“刷新”。

    您还可以尝试通过右键单击复制从物理位置复制文件,然后通过 Zend Studio/Eclipse 将其粘贴到 img 文件夹中,以确保您确实将其放置在那里。

    如果我误解了这个问题,并且这只是关于未在网络浏览器中显示的文件,请忽略上述内容并从文件路径中删除 . (但不是 /) CSS 文件使其相对于 WebRoot。

    I've had this too, but cannot remember what I did to fix it.

    Try to find the the icon depicting a small triangle pointing down (top of the file browser). It's the right most icon with a tooltip labeled View Menu. Click it and pick Filters. Check if there is a filter that might be causing the file to be invisible. If this doesn't help try switching perspectives. Also try to right click the folder and pick Refresh.

    You can also try to copy the file from the physical location by right click copy and paste it into the img folder through your Zend Studio/Eclipse to make sure you really placed it in there.

    If I misunderstood the question and this is only about the file not showing in the webbrowser, disregard the above and remove the . (but not the /) from the filepath in the CSS file to make it relative to the WebRoot.

    ~没有更多了~
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文