gpt4 book ai didi

html - 为什么无论内容大小如何,我的 CSS(显然)都会强制显示滚动条?

转载 作者:行者123 更新时间:2023-11-28 04:26:59 24 4
gpt4 key购买 nike

我很抱歉在这里粘贴了很长的代码,但这已经困扰我好几个小时了。我正在努力将我的整个站点移植到一个新模板中,并且我正在尝试使各个区域和事物更加了解大小,以便我可以将它们中的大部分包含在可调整大小的可停靠窗口和事物中,这是一个非常简洁的概念锻炼得很好。不管怎样,我有一个带有外部样式表的页面,我一辈子都弄不明白。无论内容的垂直大小如何,它都会显示一个滚动条,并且底部有 20 像素的额外空白页。我检查了又检查,但我的所有 div 似乎都是独立的,并且唯一真正的奇数位(边缘,涉及负定位)在删除时没有解决问题。

这是我在页面上使用的 HTML(它是动态生成的,这是我登录时的转储)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Objectives</title>
<script type="text/javascript" src="windows/jquery.js"></script>
<link href="windows/windows.css" rel="stylesheet" type="text/css">
<!-- Page Scripts -->

<!-- Generic "always on" scripts -->
<script type="text/javascript">
$(document).ready(function(){
//Make that backgroud !ugly
$("body").css("background-color","#000000");
$("html").css("background-color","#000000");

//Make all the tags open in new windows. Hee hee hee... good luck there
$("a").click(function () {
var url = $(this).attr("href");

//Build the URL based on a select few modifications.
if (url.charAt(0) == '?')
url = "/"+url;

//Grab the value of action for the string
var type = url.substr(url.indexOf("action=") + 7);
if (type.indexOf("&") != -1)
var type = type.substr(0, type.indexOf("&"));

parent.spawnNewWindow(url+'&noframe=none', document.title, type);
return false;
});

});

</script>

<script language="Javascript" type="text/javascript">
$(document).ready(function(){
$(".tierPickerShown").click(function () {
$(this).parent(".tier").addClass("hideme");
});
$(".tierPickerHidden").click(function () {
$(this).parent(".tier").removeClass("hideme");
});
});

</script>

</head>
<body>

<div class="tier">
<div class="tierCorner top left"></div>
<div class="tierCorner top right"></div>
<div class="tierCorner bottom left"></div>
<div class="tierCorner bottom right"></div>
<div class="tierEdgeTop"></div>
<div class="tierEdgeMiddle"></div>

<div class="tierEdgeBottom"></div>

<div class="tierPickerShown"></div><div class="tierPickerHidden"></div>
<div class="tierMarker"></div>
<div class="tierTitle">Tier 1</div>
<div class="tierSpacer"></div>


<div class="tierItem">
<div class="tierCheckbox tierActiveCheckbox "></div>
<div class="tierObjective">Choose a Nova and devote your clan to that Nova.</div>

<div class="tierUnderline"></div>
<div class="tierReward">+5 Treasure&nbsp;&nbsp;&nbsp;</div>
<div class="tierSpacer"></div>
</div>

<div class="tierItem">
<div class="tierCheckbox tierActiveCheckbox "></div>
<div class="tierObjective">Win an attack with a mage that has an item equipped.</div>
<div class="tierUnderline"></div>

<div class="tierReward">+10 Treasure&nbsp;&nbsp;&nbsp;</div>
<div class="tierSpacer"></div>
</div>

<div class="tierItem">
<div class="tierCheckbox"></div>
<div class="tierObjective">Steal at least 2 treasure from another player in a single attack.</div>
<div class="tierUnderline"></div>
<div class="tierReward">+10 Treasure&nbsp;&nbsp;&nbsp;</div>

<div class="tierSpacer"></div>
</div>

<div class="tierItem">
<div class="tierCheckbox tierActiveCheckbox "></div>
<div class="tierObjective">Complete 2 jobs.</div>
<div class="tierUnderline"></div>
<div class="tierReward">+25 Treasure&nbsp;&nbsp;&nbsp;</div>
<div class="tierSpacer"></div>

</div>

<div class="tierItem">
<div class="tierCheckbox tierActiveCheckbox "></div>
<div class="tierObjective">Win an attack on a player who is devoted to a different Nova than you are.</div>
<div class="tierUnderline"></div>
<div class="tierReward">+10 Treasure&nbsp;&nbsp;&nbsp;</div>
<div class="tierSpacer"></div>
</div>


<div class="tierItem">
<div class="tierCheckbox tierActiveCheckbox "></div>
<div class="tierObjective">Become a member of a guild.</div>
<div class="tierUnderline"></div>
<div class="tierReward">+15 Treasure&nbsp;&nbsp;&nbsp;</div>
<div class="tierSpacer"></div>
</div>

<div class="tierItem">

<div class="tierCheckbox"></div>
<div class="tierObjective">Recruit at least one (1) new player to the game using the Invite system. The player must verify their account to qualify for the objective.</div>
<div class="tierUnderline"></div>
<div class="tierReward">+200 Treasure&nbsp;&nbsp;&nbsp;</div>
<div class="tierSpacer"></div>
</div>

</div>

<div class="tier">

<div class="tierCorner top left"></div>
<div class="tierCorner top right"></div>
<div class="tierCorner bottom left"></div>
<div class="tierCorner bottom right"></div>
<div class="tierEdgeTop"></div>
<div class="tierEdgeMiddle"></div>
<div class="tierEdgeBottom"></div>

<div class="tierPickerShown"></div><div class="tierPickerHidden"></div>
<div class="tierMarker"></div>

<div class="tierTitle">Tier 2</div>
<div class="tierSpacer"></div>


<div class="tierItem">
<div class="tierCheckbox tierActiveCheckbox "></div>
<div class="tierObjective">Be in first place after 3 days, or attack someone who has joined the Light Team.</div>
<div class="tierUnderline"></div>
<div class="tierReward">+10 Treasure&nbsp;&nbsp;&nbsp;Title Awarded: Recruit</div>

<div class="tierSpacer"></div>
</div>

<div class="tierItem">
<div class="tierCheckbox tierActiveCheckbox "></div>
<div class="tierObjective">Be in second place after 3 days, or attack someone who has joined the Dark Team.</div>
<div class="tierUnderline"></div>
<div class="tierReward">+10 Treasure&nbsp;&nbsp;&nbsp;Title Awarded: Recruit</div>

<div class="tierSpacer"></div>
</div>

<div class="tierItem">
<div class="tierCheckbox"></div>
<div class="tierObjective">Donate at least 25 Treasure to your Guild</div>
<div class="tierUnderline"></div>
<div class="tierReward"></div>
<div class="tierSpacer"></div>

</div>

<div class="tierItem">
<div class="tierCheckbox tierActiveCheckbox "></div>
<div class="tierObjective">Win an attack on someone between 12 AM and 8 AM.</div>
<div class="tierUnderline"></div>
<div class="tierReward"></div>
<div class="tierSpacer"></div>
</div>


<div class="tierItem">
<div class="tierCheckbox"></div>
<div class="tierObjective">Steal at least 10 treasure from another player in a single attack.</div>
<div class="tierUnderline"></div>
<div class="tierReward"></div>
<div class="tierSpacer"></div>
</div>

<div class="tierItem">

<div class="tierCheckbox"></div>
<div class="tierObjective">Win an attack on a player who has at least 5 levels of Defense on each of his Mages at home.</div>
<div class="tierUnderline"></div>
<div class="tierReward"></div>
<div class="tierSpacer"></div>
</div>

<div class="tierItem">
<div class="tierCheckbox tierActiveCheckbox "></div>

<div class="tierObjective">Win an attack on someone on a Weekend.</div>
<div class="tierUnderline"></div>
<div class="tierReward"></div>
<div class="tierSpacer"></div>
</div>

</div>

<div class="tier">
<div class="tierCorner top left"></div>

<div class="tierCorner top right"></div>
<div class="tierCorner bottom left"></div>
<div class="tierCorner bottom right"></div>
<div class="tierEdgeTop"></div>
<div class="tierEdgeMiddle"></div>
<div class="tierEdgeBottom"></div>

<div class="tierPickerShown"></div><div class="tierPickerHidden"></div>
<div class="tierMarker"></div>
<div class="tierTitle">Tier 3</div>

<div class="tierSpacer"></div>


<div class="tierItem">
<div class="tierCheckbox"></div>
<div class="tierObjective">Be the highest ranked [Team] Recruit after 1 week, or win an attack on an enemy Cleric</div>
<div class="tierUnderline"></div>
<div class="tierReward">Title Awarded: Cleric</div>
<div class="tierSpacer"></div>
</div>


</div>
</body>
</html>

这是相应的 CSS 样式表。这是 windows.css:

/* Body information for the windower, to theme the whole thingy. */

@import url('/tier.css');

html, body {
width: 100%;
height: 100%;
padding: 0px;
margin: 0px;
background-color: #FFFFFF; /* Yes, the same color as the text. jQuery will change this to black for us, so it's a good
indicator of any syntax errors in the javascript. */
color: #DEDEDE;

/* May be changed later, to be theme-specific */
font-family: Trebuchet MS, sans-serif;
font-weight: bold;
font-size: 14px;

}

a {
color: #FFFFFF;
text-decoration: none;
}

a:hover {
text-decoration: underline;
}

/* Windowing Information Here */

/* OMITTED - Doesn't seem relevant, the classes here aren't used */

以及问题代码:tier.css

.tier {
position: relative;
width: 90%;
margin-bottom: 25px;
margin-top: 20px;
margin-left: auto;
margin-right: auto;
}

/* Classes to describe the shower/hider thing. One class for each state-- hidden and shown. The
respective class is shown based on whether or not its parent has the "hideme" class. */

.tierPickerShown {
position: relative;
display: block;
float: left;
width: 24px;
height: 24px;
margin: 4px;
z-index: 5;
background-image: url('images/show_me_shown.png');
}

.tierPickerShown:hover {
background-image: url('images/show_me_shown_hover.png');
}

.tierPickerHidden {
position: relative;
display: none;
float: left;
width: 24px;
height: 24px;
margin: 4px;
z-index: 5;
background-image: url('images/show_me_hidden.png');
}

.tierPickerHidden:hover {
background-image: url('images/show_me_hidden_hover.png');
}

.tier.hideme .tierPickerShown {
display: none;
}

.tier.hideme .tierPickerHidden {
display: block;
}

/* Container for a tier objective. Holds the checkbox and the text elements. */
.tierItem {
position: relative;
width: auto;
z-index: 5;
}

.tier.hideme .tierItem {
display: none;
}

.tierCheckbox {
float: left;
width: 32px;
height: 32px;
margin-left: 8px;
margin-right: 8px;
background-image: url('images/checkbox.png');
}

.tierActiveCheckbox {
background-image: url('images/checkbox_checked.png');
}

.tierObjective {
margin-left: 54px;
margin-bottom: 3px;
}

.tierUnderline {
/* this is just WRONG */
width: 200px;
height: 2px;
margin-left: 54px;
background-color: #000000;
}

.tierReward {
margin-left: 54px;
font-size: 0.7em;
}

.tierSpacer {
/* Empty div, designed to make sure there's some breathing room below the floated content. */
clear: both;
width: 100%;
height: 5px;
}

.tierTitle {
font-size: 2.0em;
padding-left: 54px;
z-index: 5;
}

.tierMarker {
float: left;
background-image: url('images/tier_incomplete.png');
width: 48px;
height: 32px;
}

.tierMarkerComplete {
background-image: url('images/tier_complete.png');
}

/* Aesthetics Stuff */

.tierCorner {
background-image: url('images/tier_round.png');
width: 9px;
height: 9px;
position: absolute;
}

.tierCorner.top.left {
top: -9px;
left: -9px;
background-position: 0px 0px;
}

.tierCorner.bottom.left {
bottom: -9px;
left: -9px;
background-position: 0px -9px;
}

.tierCorner.top.right {
top: -9px;
right: -9px;
background-position: -9px 0px;
}

.tierCorner.bottom.right {
bottom: -9px;
right: -9px;
background-position: -9px -9px;
}

.tierEdgeMiddle {
position: absolute;
left: -9px;
right: -9px;
height: 100%;
background-image: url('images/tier_bg.png');
z-index: 2;
}

.tierEdgeTop {
position: absolute;
width: 100%;
top: -9px;
height: 9px;
background-image: url('images/tier_bg.png');
}

.tierEdgeBottom {
position: absolute;
width: 100%;
bottom: -9px;
height: 9px;
background-image: url('images/tier_bg.png');
}

我为半糟糕的 CSS 排列表示歉意,到处都是重复的东西,但我更愿意在进行收缩代码盛宴之前了解是什么让它在正文区域自动滚动条.有没有人看到我在这里失踪的明显明显的东西?我唯一可以对该页面做的事情就是省略 tier.css,这使它看起来很奇怪。

如果你愿意,我已经设置了一个实时版本,这样你就可以看到它应该是什么样子的,图像、滚动条等等,here .

谢谢,如果有人能指出我错过的内容,这会让我多睡几个小时。

最佳答案

将高度 100% 关闭 body windows.css 修复了 Firefox 上的问题,这可能会给你一个开始寻找的地方。

关于html - 为什么无论内容大小如何,我的 CSS(显然)都会强制显示滚动条?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/768020/

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