gpt4 book ai didi

html - 我正在为 html 使用 text wrangler,但无法显示图像。

转载 作者:太空宇宙 更新时间:2023-11-04 08:13:37 25 4
gpt4 key购买 nike

我正在为 html 使用 text wrangler,但在运行代码时无法显示图像。我还需要将图像保存为 html 文件,不能使用常规图像。有谁知道如何做到这一点?

<!DOCTYPE HTML> 
<html lang=en>
<head>
<meta charset="utf-8" />
<meta name="viewport"content="width=device-width,user-scalable=yes"/>
<style type="text/css">
html{margin:0 auto;max-width:45em}
body{font-family:'Vollkorn', georgia, serif;font-size:18px; padding: 0 .5em 1em .5em; }
h1{font-size:175%;padding:1.25em 0 .75em 0;margin:0;text-align:center;word-spacing:.25em;font-weight:400;}
p{font-size:100%;line-height:1.5em;font-weight:400}
a:link{color:#0D47A1;text-decoration:none}
img{width:100%;height:auto}
figure {margin:0;}
nav{font-size:105%;margin:1.5em 0;text-align:center;line-height:1.35em;word-spacing:1.4em;font-weight:400}
footer{font-size:120%;margin:1.5em 0;text-align:center;font-weight:400;letter-spacing:0.15em;}
</style>
<title>
Saturdays are for Football
</title>
</head>
<body>
<header>
<div align="center">
<h1>Saturdays are for Football</h1>

<article>
<figure><img src="IMG_2901.jpg" width="864" height="575">
<figcaption></figcaption>
</figure>
<footer>
<a href="mailto:tac5412@psu.edu">Theresa Colombo</a>
</footer>
</body>
</html>

最佳答案

您的代码中缺少很多结束标记(标题、文章、div)。当我正确关闭所有这些并通过指向占位符图像的链接替换您的图像 src 属性时,它会正确显示:

<!DOCTYPE HTML>
<html lang=en>

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,user-scalable=yes" />
<style type="text/css">
html {
margin: 0 auto;
max-width: 45em
}

body {
font-family: 'Vollkorn', georgia, serif;
font-size: 18px;
padding: 0 .5em 1em .5em;
}

h1 {
font-size: 175%;
padding: 1.25em 0 .75em 0;
margin: 0;
text-align: center;
word-spacing: .25em;
font-weight: 400;
}

p {
font-size: 100%;
line-height: 1.5em;
font-weight: 400
}

a:link {
color: #0D47A1;
text-decoration: none
}

img {
width: 100%;
height: auto
}

figure {
margin: 0;
}

nav {
font-size: 105%;
margin: 1.5em 0;
text-align: center;
line-height: 1.35em;
word-spacing: 1.4em;
font-weight: 400
}

footer {
font-size: 120%;
margin: 1.5em 0;
text-align: center;
font-weight: 400;
letter-spacing: 0.15em;
}
</style>
<title>
Saturdays are for Football
</title>
</head>

<body>
<header>
<div align="center">
<h1>Saturdays are for Football</h1>
</div>
</header>
<article>
<figure><img src="http://placehold.it/864x575/fb4" width="864" height="575">
<figcaption></figcaption>
</figure>
</article>
<footer>
<a href="mailto:tac5412@psu.edu">Theresa Colombo</a>
</footer>
</body>

</html>

关于html - 我正在为 html 使用 text wrangler,但无法显示图像。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46064248/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com