gpt4 book ai didi

html - Div 和 H2 出现在同一行

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

我目前有以下内容:

HTML

<body>

<h1>Web Services</h1>


<div id="wrap">

<ul id="nav">
<li><a href="welcome.jsp">Home</a></li>
<li><a href="importMarketData.jsp">Service A</a></li>
<li><a href="downloadFile.jsp">Service B</a></li>
<li><a href="summaryMarket.jsp">Service C</a></li>
<li><a href="currencyMarketData.jsp">Service D</a></li>
</ul>
</div>

<h2>Overview</h2>

<div class="textParagraph">
<p>
The Web Services listed on this site allow users to retrieve, alter and summarize information contained with a "Market Data File".
A Market Data File contains data about financial instruments.
</p>
<p>
Please click on the links above for more information about our services and have a trial run.
</p>
</div>

CSS

@CHARSET "ISO-8859-1";

body {
font-family: Verdana, Arial, sans-serif;
width: 900px;
margin-left: auto;
margin-right: auto;

}


/* Begin Navigation Bar Styling */
#nav {

float: left;
margin: 0 0 3em 0;
padding: 0;
list-style: none;
background-color: #f2f2f2;
border-bottom: 1px solid #ccc;
border-top: 1px solid #ccc;
border-left:1px solid #ccc; }
#nav li {float: left;}
#nav li a {
display: block;
padding: 8px 12px;
text-decoration: none;
color: #069;
border-right: 1px solid #ccc; }
#nav li a:hover {
color: #c00;
background-color: #fff; }
/* End navigation bar styling. */

/* This is just styling for this specific page. */
#wrap {
margin-left: auto;
margin-right: auto;
background-color: #fff; }


h1 {

text-align:center;

}

h2 {

text-align:center;

}

这就是它现在的样子。

enter image description here

导航栏也应该居中对齐。我从某个站点获得了导航栏的代码。

Overview应该在下一行并以 WebServices 为中心.

我怎样才能实现这一目标?我不明白为什么 <div><h2>出现在同一行..

最佳答案

#nav 更改为类似这样的内容。

#nav {
margin: 0 0 3em 0;
padding: 0;
list-style: none;
background-color: #f2f2f2;
border-bottom: 1px solid #ccc;
border-top: 1px solid #ccc;
border-left:1px solid #ccc;
}

关于html - Div 和 H2 出现在同一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25779377/

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