div+css顶部固定浮动

<style type="text/css"><!--
#topmenu
	{top:0;
	width:100%;
	position:fixed;
	padding:10px;
	text-align:center;
	font-weight:bold;
	background:#ED9F30}
--></style>
<div id="topmenu">
	title
</div>
<div style="height:50px">
</div>
<div style="height:5000px">
	content
</div>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
好的,我会为您解答这个问题。 首先,在HTML中可以使用`<div>`标签来创建布局的各个部分,如标题栏、导航栏、内容栏和页脚栏。接下来,使用CSS来设置它们的样式和位置。 以下是一个简单的示例代码: ```html <!DOCTYPE html> <html> <head> <title>网页布局示例</title> <style> body { margin: 0; padding: 0; } #header { height: 50px; background-color: #ccc; } #nav { float: left; width: 200px; height: 400px; background-color: #ddd; } #content { margin: 0 auto; width: 800px; height: 400px; background-color: #eee; } #footer { height: 50px; background-color: #ccc; } </style> </head> <body> <div id="header"> <h1>网页标题</h1> </div> <div id="nav"> <ul> <li><a href="#">导航链接1</a></li> <li><a href="#">导航链接2</a></li> <li><a href="#">导航链接3</a></li> </ul> </div> <div id="content"> <p>网页内容</p> </div> <div id="footer"> <p>版权信息</p> </div> </body> </html> ``` 在这个示例代码中,`<div>`标签被用来创建了四个部分:标题栏、导航栏、内容栏和页脚栏。CSS样式被用来设置它们的高度、宽度、背景颜色等属性,使它们看起来更加美观。 其中,`float`属性被用来使导航栏浮动在页面左边,`margin: 0 auto`被用来使内容栏在页面中间水平居中显示。同时,`margin`和`padding`被设置为0,以确保页面的边框和内边距不影响布局。 以上就是一个基础的网页布局示例,您可以根据需要进行修改和完善。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值