gpt4 book ai didi

html - div 内容改变位置

转载 作者:行者123 更新时间:2023-11-28 13:23:13 25 4
gpt4 key购买 nike

我有一个标题 div,它是绝对的,所以我想固定它,但如果我这样做,里面的内容就会在调整窗口大小时开始改变位置。我可以使用什么技巧来实现固定的标题 div,它不会在窗口调整大小时移动内容?下面是我的代码:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"  
"http://www.w3.org/TR/html4/strict.dtd">
<head>
<title>Client </title>

<style type="text/css">
.heading {position:fixed; visibility:show; width:100%; left: 0px; top: 0px; z-index:3;
border-bottom:5px solid #ccc; }
header{
position:absolute;
width: 100%;
height: 60px !important;
z-index:7;
top: 0px;
}

/*My div position*/
.positioning-container{position:relative;
width:1000px; margin:0 auto 0 auto;
black solid; padding:0px;

padding:60px 0 30px 0;
border-bottom:0px; padding:0px;
background:#eee;}

.inner-container{position:relative;
background:#fff; padding:0px;
padding:60px 0 30px 0; }
/*My div position*/
</style>
</head>
<body>
<div class="positioning-container">
<div class="inner-container" align = "center">
<header>
<div class= "heading" style="width:100% ; height:50px; background-color:#00A5C6">
<table id ="headertable" align="left"><tr><td>
<a href="index.php"><h2 class= "logo">Client Review</h2><td>&nbsp;</td></a></td><td>
<label>Search</label><input typ= "text"></td>
<td><a href="index.php" class="button middle">search</a></td>
<td><a href="login.php" class="button middle">Login</a></td>
<td><a href="register.php" class="button middle">Add Client</a></td>
<td><a href="logout.php" class="button middle">Logout</a></td>
<td align="left" class="profile"><img src="bhubezi/images/logos/nopic.png" width="50"

height="40"></td>

</tr>
</table>
</div>
</header>
<div class="content">
content
</div>
</div>
</div>

最佳答案

你可以给你的 .heading 类一个最小宽度。

所以在你的 css 上添加类似的东西

min-width:700px;

关于您的.heading 样式

关于html - div 内容改变位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14907811/

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