html和css网页内容调整大小

标签 html css resize

这是我第一次在这个网站上发表评论。我发现这个网站过去很有帮助,但现在我似乎找不到解决我问题的方法,我希望有人能直接回答我。

我的网页使用固定的页眉和页脚以及内容所在的绝对定位面板。我的问题是,当我调整浏览器大小时,标题内容保持在固定位置> 现在很明显,我仍然希望它随着页面其余部分的滚动而移动。当我将标题设置为相对时,它确实按我的喜好工作,但随后标题导航链接位于我的下带下方并且 z-indexing 无济于事。页脚也是如此。 同样对于内容面板,当我将正文溢出设置为自动或显示时,内容面板在我滚动时会在右侧留下一个空白。 谁能帮我解决这个问题?这是非常令人沮丧的。 还有一件事,任何人都可以帮助我使用用于我的 ux-header-upperbandcontent 和 lowebandcontent 的 css 的代码吗?我想将 Logo 和其他文本放在上带,将导航链接放在下带,但使用内容包装器。

谢谢。这是我的 css 和 html 代码

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="content/style.css">
</head>
<body>
<!--BACKGROUND-->

<!--HOME--> 
<div id="home">
</div>
<!--ABOUT-->
<div id="about" class="panel">
<div class="content">
<p>about content</p>


</div>
</div>
<!--SERVICES-->
<div id="services" class="panel">
<div class="content">
<p>services content</p>


</div>


</div>
<!--CONTACT-->
<div id="contact" class="panel">
<div class="content">
<p>contact content</p>


</div>
</div>
<!--HEADER-->

<div id="ux-header">
<div id="ux-header" class="upperband">
</div>
<div id="ux-header" class="lowerband">
</div>
<div id="ux-header">
<ul id="ux-header" class="dev-navigation">
<li><a id="dev-home" href="#home">HOME</a></li>
<li><a id="dev-services" href="#services">SERVICES</a></li>
<li><a id="dev-about" href="#about">ABOUT</a></li>
<li><a id="dev-contact" href="#contact">CONTACT</a></li>
</ul>

</div>
</div>


<!--FOOTER-->
<div id="ux-footer">    
</div>
</body>
</html>




body {
min-width:980px;
margin: 0px; 
color: rgb(51, 51, 51); 
line-height: 30px; 
font-family: "Segoe UI","Helvetica",Garuda,Arial,sans-serif; 
font-size: 0.81em; 
cursor: default; 
overflow:hidden;
}
a {
color: rgb(0, 68, 204);
text-decoration: none; 
cursor: pointer;
}
img {
border:currentColor; 
border-image: none; 
max-width: 100%;
}
ul {
margin: 0px; 
padding: 0px;
}
ol {
margin: 0px; 
padding: 0px;
}
li {
margin: 0px; 
padding: 0px;
}
p {
margin: 0px; 
padding: 0px;
}
ul {
margin-bottom: 0px;
}
ul li {
margin-bottom: 0px; 
margin-left: 15px;
}
ol li {
margin-bottom: 2px; 
margin-left: 18px;
}
p {
margin-bottom: 10px;
}
h1 {
margin: 0px; 
color:rgb(104, 33, 122); 
font-weight: normal;
}
h2 {
margin: 0px; 
color:rgb(104, 33, 122); 
font-weight: normal;
}
h3 {
margin: 0px; 
color:rgb(104, 33, 122); 
font-weight: normal;
}
h1 {
line-height: 42px; 
font-size: 2.77em; 
margin-bottom: 20px;
}
h1.error {
margin-top: 50px;
}
h2 {
line-height: 34px; 
font-size: 2.16em; 
margin-bottom: 20px;
}
h3 {
line-height: 24px;
font-family: "Segoe UI Semibold","Segoe UI",Tahoma,"Microsoft Sans Serif",Verdana,sans-serif; 
font-size: 1.39em; 
margin-bottom: 20px;
}
h4 {
margin: 0px 0px 10px; 
color: rgb(51, 51, 51); 
line-height: 20px; 
font-family: "Segoe UI Semibold","Segoe UI",Tahoma,"Microsoft Sans Serif",Verdana,sans-serif; 
font-size: 1.08em;
}   
#ux-header.dev-navigation {
margin-top:60px;
width:300px;    
z-index:3;
left:70%;
white-space:nowrap;
}
#ux-header .dev-navigation li{
padding-right:10px;
margin:10px;
}
#ux-header ul.dev-navigation li{
display:inline;
}
#ux-header.dev-navigation li a {
text-transform:uppercase;
font-size:12px;
padding-bottom:0px;
margin-bottom:0px;
}
#ux-header.dev-navigation li a:hover {
padding-bottom:3px;
border-bottom-style:solid;
border-bottom-color:#4169E1;
border-bottom-width:10px;
}
#ux-header {
position:fixed;
top:0px;
z-index:2000;
width:100%;
overflow:hidden;
}
#ux-header a {
color:#FFF;
}
#ux-header ul {
margin:0px;
}
#ux-header li {
margin:0px;
}
#ux-header .upperband{
height:60px;
background-color:#000;  
}
#ux-header.upperbandcontent {
margin:0px, auto;
padding:0px, 10px;
width:100%;
max-width:980px;
}
#ux-header .lowerband {
top:60px;
height:30px;
background-color:#F42;
}
#ux-header.lowerbandcontent {
position:absolute;
margin:0px, 0px, 5px, 0px;
padding:0px, 10px;
width:100%;
max-width:980px;
}
#ux-footer {
position:fixed;
bottom:0px;
width:100%;
height:50px;
background-color:#000;
border-top-style:solid;
border-top-width:8px;
border-top-color:#0000FF;
z-index:2000;
}
.content {
font-size:12px;
padding:3px;
line-height:10px;
color:#fff;
display:inline-block;
margin:3px 0px;
z-index:-1;
}
.content h2{
font-size: 30px;
padding: 10px 0px 20px 0px;
margin-top: 52px;
color: #fff;
color: rgba(255,255,255,0.9);
text-shadow: 0px 1px 1px rgba(0,0,0,0.3);
}
.content p{
font-size: 12px;
padding: 3px;
line-height: 16px;
color: #fff;
display: inline-block;
margin: 3px 0px;
}
.panel {
position:absolute;
min-width:100%;
min-height:80%;
margin-top:90px;
right:2000px;
background-color:#FF00FF;
z-index:-2;
transition:right 2s;
overflow:hidden;
}
.panel:target {
background-color:#F6A600;
right:0;      
}
#home:target ~ #ux-header .dev-navigation #dev-home,
#about:target ~ #ux-header .dev-navigation #dev-about,
#services:target ~ #ux-header .dev-navigation #dev-services,
#contact:target ~ #ux-header .dev-navigation #dev-contact,{
    color:#000;
}

最佳答案

这就是你要找的吗?

http://jsfiddle.net/cancerian73/huawb/

 @media screen and (max-width: 400px) {
/* grid4 */
.col {
    width: 100% !important;
    margin-left: 0 !important;
    clear: none !important;
}
}

关于html和css网页内容调整大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20097905/

相关文章:

javascript - jQuery on click 每隔一段时间就不起作用

html - 溢出隐藏似乎不起作用

jquery - 动态调整列大小的css

java - 正则表达式匹配不在 <a> 标签内的短语

html - font-awesome 的奇怪渲染

javascript - 价格范围 slider 在 mozilla 浏览器中不起作用,但在 chrome 和 opera 浏览器中起作用

html:将 block 标签转换为内联标签

image - 具有自动调整图像大小的 jQuery Mobile Grid

android - 如何在 android 中有效且不损失质量的情况下调整位图的大小

c++ - 禁用窗口大小调整 Win32