gpt4 book ai didi

html - 使用 div 标签和 CSS 创建布局

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

我正在尝试为站点创建布局。我正在使用三个 div 标签,容器和左右。我希望左边是固定宽度,因为它将是导航。右侧将显示内容。右侧将从数据库加载,因此内容宽度需要根据加载的内容而变化。目前,宽度只会显示到窗口的宽度,如果您最小化窗口,内容将被截断,而不是显示滚动条并允许用户滚动查看其余数据。同样,我也无法让左右 div 一起显示。有一次我把它们放在一起,但中间有一个巨大的缺口,这不是我想要达到的效果。我只是希望在如何实现布局方面获得一些帮助。干杯,

<style> body {
background-color: #E0E0E0;
color: #000000;
}
input[type="text"] {
width: 75px;
}
#wrapper {
padding: 10px;
background-color: #9FF;
/*margin: 0 auto;*/
min-width: 500px;
overflow: auto;
border-radius: 25px;
box-shadow: 10px 10px 5px grey;
border-style: solid;
border-width: 5px;
}
.left {
/*margin:0 auto;*/
padding: 15px;
float: left;
color: #000000;
width: 150px;
border-style: solid;
border-width: 5px;
}
.right {
/*margin:0 auto;*/
padding: 15px;
float: right;
color: #000000;
min-width: 400px;
border-style: solid;
border-width: 5px;
}
</style>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Schedule Design</title>
</head>

<body bgcolor="">

<div id="wrapper">
<div class="left">
<p>This is some text</p>
<p>Here is some more</p>
<p>this is another one</p>
<p>this on is for good measure</p>
</div>
<div class="right">
<form>
<table align="center" cellpadding="5px">
<tr>
<th>Employee</th>
<th>Sunday</th>
<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
<th>Thursday</th>
<th>Friday</th>
<th>Saturday</th>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>

</table>
</form>
</div>

</div>
</body>

</html>

最佳答案

如果您从 .right 类中删除 float: right;min-width: 400px;,您应该得到右 Pane 粘贴到左 Pane 。此外,overflow: auto; 将允许您的右 Pane 滚动其宽度。

<style> body {
background-color: #E0E0E0;
color: #000000;
}
input[type="text"] {
width: 75px;
}
#wrapper {
padding: 10px;
background-color: #9FF;
/*margin: 0 auto;*/
min-width: 500px;
overflow: auto;
border-radius: 25px;
box-shadow: 10px 10px 5px grey;
border-style: solid;
border-width: 5px;
}
.left {
/*margin:0 auto;*/
padding: 15px;
float: left;
color: #000000;
width: 150px;
border-style: solid;
border-width: 5px;
}
.right {
/*margin:0 auto;*/
padding: 15px;
overflow: auto;
color: #000000;
border-style: solid;
border-width: 5px;
}
</style>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Schedule Design</title>
</head>

<body bgcolor="">

<div id="wrapper">
<div class="left">
<p>This is some text</p>
<p>Here is some more</p>
<p>this is another one</p>
<p>this on is for good measure</p>
</div>
<div class="right">
<form>
<table align="center" cellpadding="5px">
<tr>
<th>Employee</th>
<th>Sunday</th>
<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
<th>Thursday</th>
<th>Friday</th>
<th>Saturday</th>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>
<tr>
<td>Tyler Foraie</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
<td>
<input type="text" placeholder="Start Time" />
</td>
</tr>

</table>
</form>
</div>

</div>
</body>

</html>

关于html - 使用 div 标签和 CSS 创建布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32978748/

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