English 中文(简体)
HTML中的C驱动器文件路径
原标题:C drive file path in HTML

I am newbie of using HTML. I want to show image located at "C:UsersJas minefolderlandscape.jpg" in HTML. I tried all the previous posted question related to image not display while using C drive path. But those answers did not work for me. I tried the below code and the image does not display. Can you suggest which path of code is wrong?

此外,如果文件夹名中有空间,如何提供文件路径?

最后,如果我想垂直显示图像而不是水平显示图像,如何编写代码。我确实添加了空白:nowrap,但结果一直以水平顺序显示。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #images{white-space: nowrap;
                display: -moz-box;
                -moz-box-orient: veritcal;}
    </style>
</head>
<body>
    <div id="images">
        <img src="file:///C:UsersJas minelandscape.jpg" alt="file:///C:Userslandscape.jpg">
        <img src="file:///C:/Users/Jas mine/landscape.jpg" alt="file:///C:/Users/landscape.jpg">
        <img src="file:///C:UsersJas minelandscape.jpg" alt="file:///C:Userslandscape.jpg">
        <img src="file:///C:/Users/Jas mine/landscape.jpg" alt="file:///C:/Users/landscape.jpg">
        <img src="file:///C:UsersJas minelandscape.jpg" alt="file:///C:Userslandscape.jpgend">
        <img src="file:///C:/Users/Jas mine/landscape.jpg" alt="file:///C:/Users/landscape.jpgend">

        <img src="http:\localhostJas minelandscape.jpg" alt="http:\localhostlandscape.jpg">
    
    </div>
</body>
</html>

我在这里得到了结果,所有的图像都没有显示结果

问题回答

在HTML中使用文件路径时,需要使用正斜杠(/)而不是反斜杠()。此外,当文件夹名称中有空格时,应将整个路径用双引号括起来,以避免解析问题。例如:

<img src="file:///C:/Users/Jas mine/landscape.jpg" alt="landscape">




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!