gpt4 book ai didi

html - 阻止 div 重叠

转载 作者:行者123 更新时间:2023-11-28 15:40:24 25 4
gpt4 key购买 nike

好的,所以首先要做的是。我搜索了这个主题并设法找到了这个:

Prevent floating DIVs from overlapping footer

但是这并没有解决我的问题。我也尝试过其他形式的重写我设置的 css 代码,但结果反过来会弄乱我的正文内容。

我的 index.php 代码:

<?php
session_start();
?>
<html>
<link rel="stylesheet" type="text/css" href="css/main.css">



<title>
Shadey Process


</title>





<body>
<?php
include 'includes/header.php';
include 'includes/navigation.php';
?>

<div class="body">
This is the body.
Due to errors beyond my control everything I had worked so hard to do is gone.
</div>
<?php
include 'includes/footer.php';
?>
</body>


</html>

我的 main.css 代码:

@font-face { 
font-family: Kingdom; src: url('../addons/font/Kingdom.ttf');
}
.header {
padding: 20px;
color: red;
text-align: center;
border-bottom-style: solid;
border-bottom-color: green;
font-family: Kingdom;
font-size: 98px;
}

body {
background-color: black;

}
.body {

color: red;
margin-right: 34%;
}
.navlinks {
float: left;
width: 250px;
length: 100%;
background: black;
}
.footer {
float: left;
border-top-style: solid;
border-top-color: green;
position: absolute;
right: 0;
bottom: 0;
left: 0;
padding: 20px;
color: red;
text-align: center;
clear: both;
}

我的 navigation.php 代码:

<style>
.btn-group {
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
cursor: pointer;
width: 150px;
display: block;
height: 100%;
border-right-style: solid;
border-right-color: green;
}

.button {
padding: 10px 25px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
cursor: pointer;
width: 80%;
display: block;
}

.btn-group .button:not(:last-child) {
border-bottom: none; /* Prevent double borders */
}


.home {
background-color: black;
border: 1px solid red;
color: red;
}
.home:hover {
background-color: #800000;
border: 1px solid black;
color: white;
}
.forum {
background-color: black; /* Green */
border: 1px solid green;
color: green;
}
.forum:hover {
background-color: #7CFC00; /* Green */
border: 1px solid black;
color: white;
}
.alpha {
background-color: black; /* Green */
border: 1px solid blue;
color: blue;
}
.alpha:hover {
background-color: #0000FF; /* Green */
border: 1px solid black;
color: white;
}
.games {
background-color: black; /* Green */
border: 1px solid yellow;
color: yellow;
}
.games:hover {
background-color: #FFFF00; /* Green */
border: 1px solid black;
color: black;
}
</style>





<div class="btn-group navlinks">

<?php
if($_SESSION['user']==false)
{

echo '
<a href="index.php" class="button home">Home</a>
<a href="forum.php" class="button forum">Forum</a>
<a href="alpha.php" class="button alpha">Alpha</a>
<a href="games.php" class="button games">Games</a>
<a href="includes/login/index.php" class="button home">Login</a>';
}
else{
echo "<font color= 'red'>Glad to have you {$_SESSION["user"]}</font>";

echo '
<a href="index.php" class="button home">Home</a>
<a href="forum.php" class="button forum">Forum</a>
<a href="alpha.php" class="button alpha">Alpha</a>
<a href="games.php" class="button games">Games</a>
<a href="includes/logout/logout.php" class="button forum">Logout</a>';
}
?>






</div>

我的 footer.php

<div class="footer", "container-fluid" style="bottom:0; position:fixed;">
<img style="-webkit-user-select: none;
background-position: 0px 0px, 10px 10px;
background-size: 20px 20px;
background-image:linear-gradient
(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee 100%),
linear-gradient(45deg, #eee 25%, white 25%, white 75%, #eee 75%, #eee 100%);"
src="https://multicraft.mcprohosting.com/index.php?r=status/606439.png">
</div>

这是使用查看源码后渲染出来的Html:

<html>
<link rel="stylesheet" type="text/css" href="css/main.css">



<title>
Shadey Process


</title>





<body>
<div class="header">
Shadey Process
</div><style>
.btn-group {
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
cursor: pointer;
width: 150px;
display: block;
height: 100%;
border-right-style: solid;
border-right-color: green;
}

.button {
padding: 10px 25px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
cursor: pointer;
width: 80%;
display: block;
}

.btn-group .button:not(:last-child) {
border-bottom: none; /* Prevent double borders */
}


.home {
background-color: black;
border: 1px solid red;
color: red;
}
.home:hover {
background-color: #800000;
border: 1px solid black;
color: white;
}
.forum {
background-color: black; /* Green */
border: 1px solid green;
color: green;
}
.forum:hover {
background-color: #7CFC00; /* Green */
border: 1px solid black;
color: white;
}
.alpha {
background-color: black; /* Green */
border: 1px solid blue;
color: blue;
}
.alpha:hover {
background-color: #0000FF; /* Green */
border: 1px solid black;
color: white;
}
.games {
background-color: black; /* Green */
border: 1px solid yellow;
color: yellow;
}
.games:hover {
background-color: #FFFF00; /* Green */
border: 1px solid black;
color: black;
}
</style>





<div class="btn-group navlinks">


<a href="index.php" class="button home">Home</a>
<a href="forum.php" class="button forum">Forum</a>
<a href="alpha.php" class="button alpha">Alpha</a>
<a href="games.php" class="button games">Games</a>
<a href="includes/login/index.php" class="button home">Login</a>





</div>
<div class="body">
This is the body.
Due to errors beyond my control everything I had worked so hard to do is gone.
</div>

<div class="footer", "container-fluid" style="bottom:0; position:fixed;">
<img style="-webkit-user-select: none;
background-position: 0px 0px, 10px 10px;
background-size: 20px 20px;
background-image:linear-gradient
(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee 100%),
linear-gradient(45deg, #eee 25%, white 25%, white 75%, #eee 75%, #eee 100%);"
src="https://multicraft.mcprohosting.com/index.php?r=status/606439.png">
</div></body>


</html>

任何帮助和/或批评将不胜感激。

最佳答案

您正试图在 </body> 之后包含您的头文件标签。包括 <?php include 'includes/footer.php'; ?>页脚与你的 <body>标签

<?php
session_start();
?>
<html>
<link rel="stylesheet" type="text/css" href="css/main.css">
<title>
Shadey Process
</title>
<body>
<?php
include 'includes/header.php';
include 'includes/navigation.php';
?>
<div class="body">
This is the body.
Due to errors beyond my control everything I had worked so hard to do is gone.
</div>
<?php
include 'includes/footer.php';
?>
</body>
</html>

已更新(阅读 Mike 的评论后)

如果这个仍然不起作用。我认为问题出在你的footer.php请发布您的footer.php在这里或将此代码行放入您的页脚 div

<div class="container-fluid" style="bottom:0; position:fixed;">

关于html - 阻止 div 重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43548198/

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