gpt4 book ai didi

html - 调整窗口大小使标题进入页面边框

转载 作者:太空宇宙 更新时间:2023-11-03 21:59:05 25 4
gpt4 key购买 nike

我正在尝试用我一直在学习的一点技巧用 CSS 制作一个页面。我在页面顶部有标题,它看起来不错,但是当您调整窗口大小时,标题会覆盖我拥有的图像边框。我刚刚发现,它在 Firefox 中显示不佳。我该如何解决这个问题? enter image description here

<!DOCTYPE HTML PUBLIC "-//W3C//DTM HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>This is my website</title>
</head>
<style type="text/css">
body{
background-image:url('bg-body.jpg');
background-repeat: repeat;
width:967px;
}
h1 {
font-size: 40px;
position:absolute;
top: 47px;
left: 27%;
color:red;
}
.venus {
position:absolute;
top: 160px;
left: 44%;
}
#menu {
position:absolute;
top: 400px;
left: 130px;
color:blue;

height:500px;
width:290px;
background-color:#DCE1CA;
border-top: 12px outset silver;
border-left: 12px outset silver;
border-right: 5px outset silver;
border-bottom: 5px outset silver;
}
li {
line-height:200%;
font-size: large;
list-style-type:none;
list-style-image:none;

}
#textarea {
position:absolute;
top: 400px;
left: 425px;
color:blue;
text-align:left;
height:500px;
width:1149px;
background-color:#DCE1CA;
border-top: 12px outset silver;
border-left: 12px outset silver;
border-right: 5px outset silver;
border-bottom: 5px outset silver;
}
</style>
<body>
<img src="sidebar.png" width="100%" height="2000px" class="sidebar" />
<h1>Welcome to my HTML/CSS/JavaScript Page</h1>
<img src="venus.jpg" width="200px" height="200px" class="venus" />

<div id="menu">
<ul>
<li>Mix of CSS & JS</li>
<li>Your Full Name</li>
<li>How Many Apples</li>
<li>Many Questions</li>
<li>Background Color</li>
<li>My Family Event</li>
<li>Images, Images</li>
</ul>
</div>
<div id="textarea">
Here is my story: I have been learning JavaScript and on the side I have been learning some CSS/HTML.
</div>
</body>
</html>

enter image description here

enter image description here

最佳答案

我建议您将“sidebar.png”设置为背景图片,而不是实际的 <img>在 html 中。 <img>在 html 中只有当它是实际内容时才应该使用,比如你的 venus.jpg。背景被认为是样式而不是内容。

蜜蜂说我会尝试做这样的事情: Fiddle

我已将大部分解释放在 css 代码中,试图让事情变得清楚。也许它有点高级,但既然你说你正在学习 css ... ;-)

使用这种“液体”设计的优势在于 Angular 落图像不会像目前那样扭曲。您的标题在图像上运行的问题也不会再发生,这是最终的目标。

关于html - 调整窗口大小使标题进入页面边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11834048/

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