gpt4 book ai didi

带有空格且未对齐的 HTML 页面

转载 作者:行者123 更新时间:2023-11-28 09:02:34 27 4
gpt4 key购买 nike

我目前正在开发一个基本的网页。但是我的布局有一些基本问题。我会在我的菜单下方留下很多空白,无论我做什么,我的网站都不会与页面中心对齐。我添加了我的页面和css样式页面

html页面

    <!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>Lierse Liga</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div align="center">
<div class="wrapper">
<header>
<h1>Lierse Liga</h1>
<nav>
<ul class="menu">
<li><a class="button" href="index.html">Home</a></li>
<li><a class="button" href="eersteklasse.html"><img src="bal.gif" id="img1" />Eerste Klasse</a></li>
<li><a class="button" href="tweedeklasse.html">Tweede Klasse</a></li>
<li><a class="button" href="contact.html">Contact</a></li>
</ul>
</nav>
</header>
</div>
<div class="page">
<table><tr><td>
<table>
<tr>
<td colspan=2><h3>Wedstrijden Maandag</h3></td>
</tr>
<tr>
<td><p>19h</p></td><td><p>Turkse Rangers - Sinte Goemmer</p></td><td><p>0-0</p></td>
</tr>
<tr>
<td colspan=2><h3>Wedstrijden Woensdag</h3></td>
</tr>
<tr>
<td><p>19h</p></td><td><p>Turkse Rangers - Sinte Goemmer</p></td><td><p>0-0</p></td>
</tr>
<tr>
<td colspan=2><h3>Wedstrijden Vrijdag</h3></td>
</tr>
<tr>
<td><p>19h</p></td><td><p>Turkse Rangers - Sinte Goemmer</p></td><td><p>0-0</p></td>
</tr>
</table>
</td>
<td><hr width="1" size="400"></td>
<td>
<table>
<tr>
<td colspan=10><h3>Klassement</h3></td>
</tr>
<tr>
<td>Nr.</td><td>Ploeg</td><td>#wed.</td><td>W</td><td>L</td><td>X</td><td>G+</td><td>G-</td><td>G+-</td><td>Punten</td>
</tr>
<tr>
<td>1.</td><td>Turkse Rangers</td><td>4</td><td>4</td><td>0</td><td>0</td><td>33</td><td>14</td><td>19</td><td>12</td>
</tr>
<tr>
<td>2.</td><td>ZVC Sinte Goemmer</td><td>4</td><td>4</td><td>0</td><td>0</td><td>31</td><td>13</td><td>18</td><td>12</td>
</tr>
<tr>
<td>3.</td><td>Den Boechout</td><td>5</td><td>4</td><td>1</td><td>0</td><td>30</td><td>16</td><td>14</td><td>12</td>
</tr>
<tr>
<td>4.</td><td>Garage Van Rompaey</td><td>3</td><td>3</td><td>0</td><td>0</td><td>40</td><td>9</td><td>31</td><td>9</td>
</tr>
</table>
</td></tr></table>
</div>
</div>
</body>
</html>

在我网页的css下面

@charset "utf-8";
html{
font:12pt;
font-family:Verdana, Geneva, sans-serif;
}
body{margin:0px;}
header h1{
float:left;
}
header{
background-color:white;
font:"Palatino Linotype", "Book Antiqua", Palatino, serif;
color:#F00;
float:left;
display:block;
}
nav{
background-color:#F00;
float:right;
height:60px;
display:block;
width:auto;
}
nav a{
text-decoration:none;
list-style:none;
color:white;
font-size:20px;
padding:8px;
}
nav li:hover,a:hover{
color:black;
}
li{
display:inline;
}
img{
border-color:#F00
}
.page{
float:left;
}
.verticalline{
border-left: thick solid #ff0000;
}

最佳答案

请检查我已更改的此 html。将一个 class="container"分配给 body 中的拳头 div,并为此类赋予宽度,而不是使它向左浮动。也将 margin 0px auto 分配给它。

.container {
margin: 0px auto;
width: 800px;
}

还可以通过提供以下样式使您的 h1 标签在文档流中看起来不错。

header h1 {
float: left;
margin: 11px;
}

最后,您的所有代码都在下面,只需将其复制并粘贴到您的 html 中即可查看结果

    <!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>Lierse Liga</title>
<style type="text/css">
@charset "utf-8";
html{
font:12pt;
font-family:Verdana, Geneva, sans-serif;
}
body{margin:0px;}
.container { margin: 0px auto; width: 800px; }
header h1{
float: left;
margin: 11px;
}
header{
background-color:white;
font:"Palatino Linotype", "Book Antiqua", Palatino, serif;
color:#F00;
float:left;
display:block;
}
nav{
background-color:#F00;
float:right;
height:60px;
display:block;
width:auto;
}
nav a{
text-decoration:none;
list-style:none;
color:white;
font-size:20px;
padding:8px;
}
nav li:hover,a:hover{
color:black;
}
li{
display:inline;
}
img{
border-color:#F00
}
.page{
float:left;
}
.verticalline{
border-left: thick solid #ff0000;
}

</style>
</head>
<body>
<div class="container">
<div class="wrapper">
<header>
<h1>Lierse Liga</h1>
<nav>
<ul class="menu">
<li><a class="button" href="index.html">Home</a></li>
<li><a class="button" href="eersteklasse.html"><img src="bal.gif" id="img1" />Eerste Klasse</a></li>
<li><a class="button" href="tweedeklasse.html">Tweede Klasse</a></li>
<li><a class="button" href="contact.html">Contact</a></li>
</ul>
</nav>
</header>
</div>
<div class="page">
<table><tr><td>
<table>
<tr>
<td colspan=2><h3>Wedstrijden Maandag</h3></td>
</tr>
<tr>
<td><p>19h</p></td><td><p>Turkse Rangers - Sinte Goemmer</p></td><td><p>0-0</p></td>
</tr>
<tr>
<td colspan=2><h3>Wedstrijden Woensdag</h3></td>
</tr>
<tr>
<td><p>19h</p></td><td><p>Turkse Rangers - Sinte Goemmer</p></td><td><p>0-0</p></td>
</tr>
<tr>
<td colspan=2><h3>Wedstrijden Vrijdag</h3></td>
</tr>
<tr>
<td><p>19h</p></td><td><p>Turkse Rangers - Sinte Goemmer</p></td><td><p>0-0</p></td>
</tr>
</table>
</td>
<td><hr width="1" size="400"></td>
<td valign="top">
<table>
<tr>
<td colspan=10><h3>Klassement</h3></td>
</tr>
<tr>
<td>Nr.</td><td>Ploeg</td><td>#wed.</td><td>W</td><td>L</td><td>X</td><td>G+</td><td>G-</td><td>G+-</td><td>Punten</td>
</tr>
<tr>
<td>1.</td><td>Turkse Rangers</td><td>4</td><td>4</td><td>0</td><td>0</td><td>33</td><td>14</td><td>19</td><td>12</td>
</tr>
<tr>
<td>2.</td><td>ZVC Sinte Goemmer</td><td>4</td><td>4</td><td>0</td><td>0</td><td>31</td><td>13</td><td>18</td><td>12</td>
</tr>
<tr>
<td>3.</td><td>Den Boechout</td><td>5</td><td>4</td><td>1</td><td>0</td><td>30</td><td>16</td><td>14</td><td>12</td>
</tr>
<tr>
<td>4.</td><td>Garage Van Rompaey</td><td>3</td><td>3</td><td>0</td><td>0</td><td>40</td><td>9</td><td>31</td><td>9</td>
</tr>
</table>
</td></tr></table>
</div>
</div>
</body>
</html>

关于带有空格且未对齐的 HTML 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26846473/

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