gpt4 book ai didi

javascript - 全页面布局的基本设计

转载 作者:可可西里 更新时间:2023-11-01 14:47:33 28 4
gpt4 key购买 nike

很抱歉,如果之前有人问过这个问题,但我一直在寻找,但仍然无法想出一个基本设计来实现我想要的布局(确认我不想要顶部和底部的空白)

我拥有一个个人摄影网站,我将我的业余摄影作品发布给 friend 和家人,我想让它看起来更好一点,在我的脑海中,我希望每个页面都不可滚动,我会确保内容合理地适合空间。

我目前并不担心移动设备和平板设备上的空间有限,因为当我有了基本结构后,我计划制作一个移动设备和一个平板电脑页面,这样我就可以指定设计而不是一个流动的网站。 (我可能会在以后转移到这个)

所以我想将下面的示例作为我的页面布局

Img Link

我不确定我的代码离我有多远我相信我已经差不多了,我只是错过了允许我的主 div 被限制在结束之间屏幕上剩余的可用空间的位hr noshade 并在页脚 div 开始之前停止,这将允许图片成为 div 的 100% 高度并且图片(或其他对象)将根据查看区域的大小重新调整大小

我真的很感谢任何帮助,如果之前有人问过,我再次道歉,我尽力不建立表格格式的网站,因为我知道这是现在非常古老的编码方式

我做了一些研究,认为我可能需要使用 jquery squirt 来设置文档/窗口的高度,但由于我是新手,我找不到一个好的例子

总而言之,我只想让主 div 从 hr noshade 行的底部延伸到页脚的顶部。

@charset "utf-8";

/* CSS Document */

* {
padding: 0px;
margin: 0px;
}
html,
body {
margin: 0;
padding: 0;
height: 100%;
}
* html #outer {
/* ie6 and under only*/
height: 100%;
}
.content {
padding-top: 20px;
}
.wrapper {
min-height: 100%;
margin: -20px auto 0;
/*Change this to change height of footer must match .footer height number*/
width: 70%;
}
.footer {
height: 20px;
/*Change this to change height of footer must match .wrapper margin -number*/
background-color: #2C5463;
text-align: center;
width: 70%;
color: #FCFCFC;
margin-left: auto;
margin-right: auto;
border-radius: 151px;
}
.title {
font-size: 50px;
font-family: tangerine;
font-style: normal;
font-weight: 700;
font-variant: normal;
color: #2C5463;
float: left;
width: 100%;
margin-bottom: 2px;
margin-top: 10px;
}
.main {
float: left;
width: 100%;
background-color: #F80307;
}
hr {
border-radius: 208px;
border-width: 2px;
border-color: #2C5463;
}
.menu {
text-align: center;
color: #FCFCFC;
background-color: #2C5463;
float: left;
width: 100px;
margin-right: 5px;
padding-top: 3px;
padding-right: 3px;
padding-bottom: 3px;
padding-left: 3px;
border-radius: 38px;
}
.menu2 {
text-align: center;
color: #FCFCFC;
background-color: #2C5463;
float: Right;
width: 100px;
padding-top: 3px;
padding-right: 3px;
padding-bottom: 3px;
padding-left: 3px;
border-radius: 38px;
}
.menuwrapper {
width: 100%;
float: left;
margin-top: 2px;
margin-bottom: 2px;
}
<!DOCTYPE html>
<html lang="en">

<head>

<!--Start of CSS Link-->
<link href="test.css" rel="stylesheet" type="text/css">
<style type="text/css">
body {
background-color: #e4e5e7;
}
</style>
<!--End of CSS Link-->

<!--Start of Fonts-->
<script>
var __adobewebfontsappname__ = "dreamweaver"
</script>
<script src="http://use.edgefonts.net/tangerine:n4,n7:default.js" type="text/javascript"></script>
<!--End of Fonts-->

<meta charset="utf-8">
</head>
<!--Start of Webpage-->

<body>
<!--Start of Page Wrapper (no main content above this line-->
<div class="wrapper">
<!--Start of Main Content-->
<div class="content">
<!--Start of Page Content-->
<!--Start of Title-->
<div class="title">
<p>Skc Photography</p>
</div>
<!--End of Title-->
<!--Start of Member Login--
<div class="login"><p>Member Login</p></div>
<!--End of Member Login-->
<!--Start of line-->
<hr noshade>
<!--Start of line-->
<!--Start of Menu-->
<div class="menuwrapper">
<div class="menu">
<p>Home</p>
</div>
<div class="menu">
<p>Galleries</p>
</div>
<div class="menu">
<p>Contact Me</p>
</div>
<div class="menu2">
<p>Member Login</p>
</div>
</div>
<!--End of Menu-->
<!--Start of line-->
<hr noshade>
<!--Start of line-->
<!--Start of Main Content-->
<div class="main">This div needs to stretch to top of the Footer and not past it.
</div>
<!--End of Main Content-->
</div>
<!--End of Page Content-->
</div>
<!--End of Page Wrapper (no main content Below this line-->
<!--Start of Footer-->
<div class="footer">SKCPhotography - Copyright &copy; 2014</div>
<!--End of Footer-->
</body>
<!--End of Webpage-->

</html>

最佳答案

你可以只添加一个 position: absolute.main div,然后添加父 .wrapper position: relative ,然后从那里开始工作,检查一下 here

.main{
position: absolute;
bottom: 0;
top: 126px;/*the height of the header menu, hr etc.*/
right: 0;
}
.wrapper{
position: relative;
}

关于javascript - 全页面布局的基本设计,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27160238/

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