gpt4 book ai didi

css - 我的垂直导航只和我的窗口一样高,不知道为什么

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

当网站的内容比窗口大时(无论窗口多高,这条规则都适用)。这是非常不受欢迎的行为,因为它看起来像 #@!*...

我对网页设计很陌生,所以我可能真的在我的 css 中犯了一些大错误。这是 css 文件,希望有人能指出来。(可能使用 height: 100% 是不好的,但不要'不知道还能做什么 =/。

而且我知道对于内容和东西来说绝对是非常糟糕的。

这就是“错误”的样子,当内容比窗口大时位于底部: http://i49.tinypic.com/1zqa9th.png

这是一个 html 框架:

<!DOCTYPE html>
<html>
<head>
<?php
$title_tags = "TITLE HERE";
$meta_description = "";
include('generalhead.php'); ?>
</head>

<body>
<div class="wrapper">
<div class="sidebar">
<div class = "wrap1">
<img src="media/images/blub.png" class="blub"><br>

<div class="cloud">
<img src="media/images/dots.gif">
<img class="cloud_text" src="media/images/cloud.png">
<img src="media/images/dots.gif">
</div>

<div class="menu">
<ul id="nav" class="navig">
<h3 class="big_link"><a href="index.php">home</a></h3>
<h3 class="big_link"><a href="contact.php">contact</a></h3>
<h3>Algemene dakwerken</h3>
<li><a href="epdm.php">Epdm</a></li>
<li><a href="pannen.php">pannen</a></li>
<li><a href="zink.php">zink</a></li>
<li><a href="koper.php">koper</a></li>
<li><a href="dakconstructie.php">dakconstructie</a></li>
<li><a href="velux.php">velux steken</a></li>
<li><a href="oversteking.php">uitbekleden oversteking</a></li>
<h3>binnenhuisinrichting</h3>
<li><a href="ramen_deuren.php">ramen en deuren</a></li>
<li><a href="gyproc.php">gyproc</a></li>
<li><a href="muren_plafonds.php">muren en plafonds</a></li>
</ul>
</div>
</div>
</div>
</div>

<div class="content">
<div class="content-top">
<div class="content-head">
blub
</div>

<div class="content-body">
CONTENT TEXT COMES HERE, BELLOW THIS ARE THE CONTENT PICTURES
</div>

<div class="content-pictures">
<!-- Slider-->
<div class="slider-wrapper theme-default">

<div id="slider" class="nivoSlider">
<?php
$directory_name = "index";
include ("generate_photo_content.php");
?>
</div>

</div>
</div>

</div>

</div>

</div>

<?php include ('bottomscripts.php'); ?>
</body>
</html>​

CSS 在这里

    body{
/* FALLBACK KLEUR ALS GRADIENT NIET WERKT*/
background-color: #1b1000;

height: 100%;
font-size: 100%
}

/*ROND ALLES EN ZORGT VOOR GRADIENT OP BACKGROUND*/
.wrapper{
display:block;

/*set the div in the top-left corner of the screen*/
position:absolute;
top:0;
left:0;

/*set the width and height to 100% of the screen*/
width: 100%;
height:100%;

/* IE10 Consumer Preview */
background-image: -ms-radial-gradient(left center, circle farthest-side, #4D2D0F 0%, #1B1000 50%, #1B1000 100%);

/* Mozilla Firefox */
background-image: -moz-radial-gradient(left center, circle farthest-side, #4D2D0F 0%, #1B1000 50%, #1B1000 100%);

/* Opera */
background-image: -o-radial-gradient(left center, circle farthest-side, #4D2D0F 0%, #1B1000 50%, #1B1000 100%);

/* Webkit (Safari/Chrome 10) */
background-image: -webkit-gradient(radial, left center, 0, left center, 973, color-stop(0, #4D2D0F), color-stop(0.5, #1B1000), color-stop(1, #1B1000));

/* Webkit (Chrome 11+) */
background-image: -webkit-radial-gradient(left center, circle farthest-side, #4D2D0F 0%, #1B1000 50%, #1B1000 100%);

/* W3C Markup, IE10 Release Preview */
background-image: radial-gradient(circle farthest-side at left center, #4D2D0F 0%, #1B1000 50%, #1B1000 100%);
}

.sidebar {
z-index: 999;
background-color: #ffcc00;
/*background-image: url(../images/bar-8.png);*/
background-repeat: no-repeat;
background-image: url(../images/bar.jpg);
background-repeat:repeat-y;
-moz-box-shadow: 5px 0px 6px #000000;
-webkit-box-shadow: 5px 0px 6px #000000;
box-shadow: 5px 0px 6px #000000;
width: 200px;
height: 100%;
float: left;
}

.wrap1{
position: relative;
top:15px;
}

.logo{
position: absolute;
top: 0;
left: 4px;
}

.blub{
position: relative;
float:left;
width: 100%;
margin: 0 0 10px 0;
}

.cloud{
position: relative;
float: left;
width: 100%
}
.cloud_text{
margin: 0 0 0 0;
}

.menu{
line-height: 1;
margin: 0 0 0 10px;
position: relative;
float: left;
width: 100%
}

a {
text-decoration: none;
}

ul {
margin: 0;
padding: 0;
list-style: none;
}


.menu {
width: 200px;
margin: 10px auto;
font-size: 0.8125em;
text-transform: uppercase;
}

.navig{
width: auto;
height: auto;
}

.navig > li > a{
border-bottom: 1px solid #c68f00;
width: 100%;
height: 1.5em;
font-size: 0.8em;
line-height: 1.5em;
text-indent: 16px;
display: block;
position: relative;
font-family: "Helvetica Neue", Helvetica, Areal, sans-serif;
font-weight: 600;
color: #603913;
text-shadow: 0px 1px 0px rgba(0,0,0,0.5);
-webkit-transition: all 1s linear;
}
.navig > h3{
margin: 0 0 0 0;
border-bottom: 2px solid #c68f00;
width: 100%;
height: 2.25em;
line-height: 2.75em;
text-indent: 10px;
display: block;
position: relative;
font-family: "Helvetica Neue", Helvetica, Areal, sans-serif;
font-weight: 600;
color: #603913;
text-shadow: 0px 1px 0px rgba(0,0,0,0.5);
}

.navig > li > a:hover,
.navig > li > a:active{
background-color: #fdda01;
background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(252, 219, 0)),to(rgb(255,204,0)));
background-image: -webkit-linear-gradient(top, rgb(252, 219, 0), rgb(255,204,0));
background-image: -moz-linear-gradient(top, rgb(252, 219, 0), rgb(255,204,0));
background-image: -o-linear-gradient(top, rgb(252, 219, 0), rgb(255,204,0));
background-image: -ms-linear-gradient(top, rgb(252, 219, 0), rgb(255,204,0));
background-image: linear-gradient(top, rgb(252, 219, 0), rgb(255,204,0));
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#45c7eb', EndColorStr='#2698db');
border-bottom: 1px solid #886304;
}

.big_link > a {
margin: 0 0 0 0;
border-bottom: 2px solid #c68f00;
width: 100%;
height: 2.25em;
line-height: 2.75em;
text-indent: 10px;
display: block;
position: relative;
color: #603913;
text-shadow: 0px 1px 0px rgba(0,0,0,0.5);
}
.big_link> a:active,
.big_link > a:hover{
background-color: #fdda01;
background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(252, 219, 0)),to(rgb(255,204,0)));
background-image: -webkit-linear-gradient(top, rgb(252, 219, 0), rgb(255,204,0));
background-image: -moz-linear-gradient(top, rgb(252, 219, 0), rgb(255,204,0));
background-image: -o-linear-gradient(top, rgb(252, 219, 0), rgb(255,204,0));
background-image: -ms-linear-gradient(top, rgb(252, 219, 0), rgb(255,204,0));
background-image: linear-gradient(top, rgb(252, 219, 0), rgb(255,204,0));
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#45c7eb', EndColorStr='#2698db');
border-bottom: 2px solid #886304;
}

.selected{
background-color: #fdda01;
background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(252, 219, 0)),to(rgb(255,204,0)));
background-image: -webkit-linear-gradient(top, rgb(252, 219, 0), rgb(255,204,0));
background-image: -moz-linear-gradient(top, rgb(252, 219, 0), rgb(255,204,0));
background-image: -o-linear-gradient(top, rgb(252, 219, 0), rgb(255,204,0));
background-image: -ms-linear-gradient(top, rgb(252, 219, 0), rgb(255,204,0));
background-image: linear-gradient(top, rgb(252, 219, 0), rgb(255,204,0));
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#45c7eb', EndColorStr='#2698db');
border-bottom: 1px solid #886304;

}

最佳答案

简答:

这是您当前的 HTML 标记和 CSS 定义以及请求的最终结果:

查看此工作 Fiddle Example !

enter image description here


长答案

问题中显示的当前代码包含几个标记问题:

  1. 无序列表 (UL) 的子元素:

    参见 W3C - Lists in HTML documents

    <ul/>元素只能有<li/>作为一个 child 。目前您正在放置 <h3/><li/> 混合元素。

  2. 结束标签 <div/>元素:

    • 您正在使用 12 个开始标签。

    • 您正在使用 13 结束标签。

    • 松一闭div在您的 ul 之后声明让标记按预期工作。


关于您的侧边栏高度问题

我已尝试使用您提供的代码,但结构过于困惑,无法通过纯 CSS 解决方案实现您的目标。

所以我反其道而行之,准备了所需的结构以将您的内容应用到其中。 Fiddle Example 上的标记解决了您的问题。

HTML MARKUP 基本布局

<div class="wrapper">
<div class="sidebar">
<ul>
<li>Sidebar stuff.</li>
</ul>
</div>
<div class="content">
CONTENT TEXT COMES HERE, BELLOW THIS ARE THE CONTENT PICTURES
</div>
<div class="clear"></div>
</div>

CSS 准备布局的基础知识

* {
margin: 0;
padding: 0;
}
.clear { clear: both; }
.wrapper {
position: relative;
}
.sidebar {
width: 200px;
float: left;
background-color: #ffcc00;
position: absolute;
top: 0;
left: 0;
bottom: 0;
}
.content {
margin-left: 200px;
}

您所要做的就是应用此标记并用您的内容填充它。

enter image description here

关于css - 我的垂直导航只和我的窗口一样高,不知道为什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11382913/

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