gpt4 book ai didi

html - 页面链接不会显示

转载 作者:太空宇宙 更新时间:2023-11-04 08:20:53 27 4
gpt4 key购买 nike

我是 HTML/CSS 的新手,我正在制作一个网站。

我想在页面顶部放置一个链接,但它没有显示。根据浏览器开发人员工具,它就在那里,但在标题后面。我给了它最高的 z-index 。 (我知道有很多事情要做,但我不知道是什么导致了这个问题。)

这是我的 HTML 代码:

body {
margin: 0;
padding: 0;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #444;
}

header {
position: fixed;
right: 0;
z-index: 99;
background-color: #EC7063;
height: 135px;
width: 100%;
opacity: .9;
margin-bottom: 0px;
}

header h1.logo {
box-sizing: content-box;
height: 100%;
margin: 0;
font-size: 5vw;
color: #fff;
text-transform: uppercase;
float: left;
line-height: 200px;
}

header h1.logo:hover {
color: #fff;
text-decoration: none;
}

div.home {
margin-top: -50px;
box-sizing: border-box;
position: relative;
opacity: .8;
}

div.about {
background-color: #F5B7B1;
}

h2 {
font-size: 3em;
margin-top: 40px;
text-align: center;
letter-spacing: -2px;
}

h3 {
font-size: 1.7em;
font-weight: 100;
margin-top: 30px;
text-align: center;
letter-spacing: -1px;
color: #999;
}

.menu {
position: static;
z-index: 1000;
float: right;
margin-top: 18px;
margin-right: 18px;
line-height: 0px;
}

.menu li {
position: static;
display: block;
}

.menu li+li {
position: static;
margin-left: 35px;
}

.menu li a {
position: static;
color: #444;
text-decoration: none;
}

img.home_img {
box-sizing: content-box;
position: relative;
width: 100%;
height: auto;
}

img {
margin: -5px;
}

.container {
display: ;
}
<!DOCTYPE html>
<html>

<head>
<title>My Sugar</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">
</head>

<body>
<header>
<h1 class="logo">Sugar me</h1>
<strong><nav>
<ul class="menu">
<li><a href="{{ url_for('home') }}">Home</a></li>
<li><a href="{{ url_for('about') }}">About</a></li>
</ul>
</nav></strong>
</header>
{% block content %} {% endblock %}
</body>

</html>

最佳答案

我已经在 J​​SFiddle 中重新创建了页面,

https://jsfiddle.net/Kai_Draord/gme434hp/2/

变化:1. 为了水平显示列表项,我使用了 css“display:inline;”详情请查看引用资料。

  1. 我知道您想将标题固定到顶部,所以我添加了“top:0px”以将标题固定到顶部。

  2. 我把网站内容打包了

    {% block content %} {% endblock %}

在容器类中,为了在标题下方显示它,我添加了 css“margin-top:135px;”和其他一些样式,这样它看起来会更好,不会隐藏在标题后面。

请在下面找到容器类的 css。

.container {
display: block;
position:relative;
z-index:1000;
margin-top:135px;
}

每当您制作网站时,在浏览器中按 F12 并使用 CSS 属性,这将帮助您更快地获得所需的结果。谢谢。

引用:menu items

关于html - 页面链接不会显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45544912/

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