HTML 布局

HTML 布局 - 使用<div> 元素

div 元素是用于分组 HTML 元素的块级元素。

下面的例子使用五个 div 元素来创建多列布局:

复制代码
<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title> )</title> 
</head>
<body>
 
<div id="container" style="width:500px">
 
<div id="header" style="background-color:#FFA500;">
<h1 style="margin-bottom:0;">主要的网页标题</h1></div>
 
<div id="menu" style="background-color:#FFD700;height:200px;width:100px;float:left;">
<b>菜单</b><br>
HTML<br>
CSS<br>
JavaScript</div>
 
<div id="content" style="background-color:#EEEEEE;height:200px;width:400px;float:left;">
内容在这里</div>
 
<div id="footer" style="background-color:#FFA500;clear:both;text-align:center;">
版权 © runoob.com</div>
 
</div>
 
</body>
</html>
相关推荐
墨夏3 分钟前
TS 高级类型
前端·typescript
程序猿师兄12 分钟前
若依框架前端调用后台服务报跨域错误
前端
前端小巷子16 分钟前
跨标签页通信(三):Web Storage
前端·面试·浏览器
工呈士16 分钟前
TCP 三次握手与四次挥手详解
前端·后端·面试
BillKu17 分钟前
Vue3 + TypeScript + Element Plus + el-input 输入框列表按回车聚焦到下一行
前端·javascript·typescript
复苏季风18 分钟前
前端程序员unity学习笔记01: 从c#开始的入门,using命名空间,MonoBehaviour,static,public
前端
阿古达木20 分钟前
沉浸式改 bug,步步深入
前端·javascript·github
stoneSkySpace30 分钟前
react 自定义状态管理库
前端·react.js·前端框架
堕落年代42 分钟前
SpringAI1.0的MCPServer自动暴露Tool
前端
南囝coding1 小时前
一篇文章带你了解清楚,Google Cloud 引发全球互联网服务大面积故障问题
前端·后端