I'm finding that relative path names in HTML are working differently in Safari (14.0.3) and Chrome (88.0.4324.96) on my MacBook.
If I have all the files in one place (see below), everything is fine, both in Safari and Chrome.
<!DOCTYPE html>
<html>
<head>
<!-- the style sheet is local -->
<link rel="stylesheet" type="text/css" href="style_sheet.css" />
<title>HTML 101 - title A</title>
</head>
<body>
<p>This is a line of HTML - page A</p>
<! -- let's have a local picture -->
<img src="yellow.jpg" alt="Welcome!">
</body>
</html>
But I want the HTML and pictures to be in different places. Suppose I have an 'html' directory and an 'images' directory, with a style sheet one level above. (See below.) This works fine in Chrome, but in Safari, the style sheet is not picked up, and the image is not displayed.
<!DOCTYPE html>
<html>
<!-- let's start at the very beginning -->
<head>
<!-- the style sheet is one level above -->
<link rel="stylesheet" type="text/css" href="../style_sheet.css" />
<title>HTML 101 - title B</title>
</head>
<body>
<p>This is a line of HTML - page B</p>
<!-- the image file is in a sibling folder -->
<img src="../images/yellow.jpg" alt="Welcome!">
</body>
</html>
How do relative pathnames work in HTML in Safari?
question from:
https://stackoverflow.com/questions/66067544/relative-pathnames-working-differently-on-safari-and-chrome 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…