gpt4 book ai didi

html - 如何将带有两个标题的图片放在网页的同一区域?

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

我创建了以下网页以及一个 css 文件,我试图在其中将包含两行的图片放在标题部分,但文本行来自标题文件。提前致谢。

#header {
background-color: lightblue;
height: 150px;
}

#header h1, h2 {
text-align: center;
}
<html>
<head>
<title>Perfect Page</title>
<link href="css/tsgeneral.css" type="text/css" rel="stylesheet">
</head>
<body>
<div id ="header">
<img src="pics/ts1.jpg" height="150" width="150" alt="tsIncanda">
<h1>Tss Fans Page</h1>
<h2>Welcome Fans</h2>
</div>
</body>
</html>

最佳答案

在图像上使用 float 。

#header img {
float: left;
}

关于html - 如何将带有两个标题的图片放在网页的同一区域?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26445020/

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