简体   繁体   English

导航栏链接和h1

[英]Nav bar links and a h1

I'm trying to make a nav bar with a header and then 2 links on each side. 我正在尝试制作一个带有标题的导航栏,然后在每一侧添加2个链接。 But when it test it on a local host it seems to make it like this when i want to it be all horizontal. 但是,当我在本地主机上对其进行测试时,它看起来像是这样。

LINK LINK
TITLE(h1)
LINK LINK

Html: HTML:

<body>
    <div id="navigation">
    <a href="index.html">Index</a>
        <a href="index.html">Home</a>
        <h1>Home</h1>
        <a href="index.html">Home</a>
        <a href="index.html">James</a>
    </div>
</body>

css: CSS:

#navigation 
{
position: fixed;
top: 0;
left:0;
right:0;
width: 100%;
color: #ffffff;
height: 120px;
text-align: center;
padding-top: 15px;
-webkit-box-shadow: 0px 0px 8px 0px #000000;
-moz-box-shadow: 0px 0px 8px 0px #000000;
box-shadow: 0px 0px 8px 0px #000000;
background-color:#666;}

#navigation a 
{
font-size: 18px;
padding-left: 15px;
padding-right: 15px;
color: white;
text-decoration: none;
}

#navigation h1
{
font-size: 25px;
padding-left: 15px;
padding-right: 15px;
color: white;
text-decoration: none;
}

Why does it go like this? 为什么会这样?

LINK LINK
TITLE
LINK LINK?

Thanks! 谢谢!

Based on the information provided, it seems that your Title "h1" is set to display:block . 根据提供的信息,您的标题“ h1”似乎设置为display:block Change it to display: inline . 更改为display: inline

Just move the <h1>Home</h1> after <div id="navigation"> . 只需将<h1>Home</h1>移动到<h1>Home</h1> <div id="navigation"> Your code should be 您的代码应为

<body>
<div id="navigation">
<h1>Home</h1>
    <a href="index.html">Index</a>
    <a href="index.html">Home</a>
    <a href="index.html">Home</a>
    <a href="index.html">James</a>
</div>
</body>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM