html网页结构topbar,html - Fixed Topbar and Content Div - Stack Overflow

I'm new to HTML and CSS and having some beginner troubles.

I want to have a fixed navigation bar on the top (which is fixed) so it would stick on the top even if the user scrolls the page.

and below is the content page.

how I want the page to act is that when the user scrolls the page the content page should go under the navigation bar.

in my case the the navigation bar is fixed but when scrolled the content div covers the navigation bar.

my codes are as follows

mascot.jpg

orb.pngSign In/Up

and the css code is as follows:

body{

margin:0;

}

#TopBar{

background-color:#FFFFFF;

width:100%;

height:100px;

color:#174269;

position:fixed;

font-weight:bold;

font-size:1.2em;

border-bottom:1px ridge black;

}

.fixedwidth{

width:1050px;

margin:0 auto;

}

#logodiv {

float:left;

padding-bottom:5px;

}

#logodiv img{

width:188px;

height:100px;

}

#signInDiv{

float:right

}

#signInDiv img{

position:relative;

top:6px;

}

#signInDiv p{

position:relative;

top:20px;

}

.break{

clear:both;

}

#mainContentDiv{

position:relative;

top:100px;

width:100%;

height:1000px;

background-color: #0C7ECC;

}

I know that it has an easy solution but just can't figure it out.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值