试图将图片插入具有id元素的外部CSS中,但解决方案无答案

问题描述 投票:0回答:1

图像的路径正是键入它的方式,但仍然看不到任何结果。这样做的时间比理智的时间长,并且在无数的教程和论坛筛选后没有任何效果。ps。路径如下所示:C:\ users \ my_name \ Desktop \ Consoles \ Html备忘单\ Html Exercise \ Images \ Pain Stake准系统。

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="css/css%style.css">
</head> 
<body>

    <div id="picture-css">````





    </div>


</body> 
</html></code></pre>





   ````<code><pre> 
          #picture-css
          {
          width:900px;
          height:auto;
          background-image:url(../Images/Pain Steak  barebones.png);
          } 
          </code></pre>````





html css image id
1个回答
1
投票

background-image:url('../Images/Pain Steak barebones.png');

有效,但为了证明也尝试设置:min-height:200px;

因为height:auto;没有强制非零高度。

我在这里有一个有效的示例:http://xcc.me/222/

更新:%中的href="css/css%style.css"是一个特殊字符,无法单独使用,因此,如果无法在HTML中重命名css%style.css,则可以将其写为[]

<link rel="stylesheet" href="css/css%25style.css">

因为UTF8中%的文本编码版本为%25,所以可以使用。

示例:http://xcc.me/223/

© www.soinside.com 2019 - 2024. All rights reserved.