当前位置: 首页 > article >正文

DIV+CSS布局(进阶篇)

   学习前端必不可少的就是学习HTML语言以及CSS样式的布局,这也通常是新手入门的拦路虎,结合上次的入门篇的两种布局样式,又写了两个变化的样式。基础样式都是有DIV+CSS样式进行不断的变化出来的,熟练后可以变化出其他的想要的样式布局。

DIV+CSS布局

第一种布局样式:css三行三列布局

代码如下:

<!DOCTYPE html>
<html>
<head><title>css三行三列布局</title><style type="text/css">*{margin: 0;padding: 0;}#container{margin: 0 auto;width: 1000px;height: 600px;	}#header{height: 100px;background-color: #fc9;margin-bottom: 5px;}#main{width: 1000px;height: 500px;margin-bottom: 5px;}.aside{float: left;width: 150px;height: 500px;}#aside1{/*float: left;width: 150px;height: 500px;*/background-color: #fc9;margin-right: 5px;}#content{float: left;width: 690px;height: 500px;background-color: #ccc;}#aside2{/*float: left;width: 150px;height: 500px;*/background-color: #fc9;margin-left: 5px;}#botton{height: 90px;background-color: #ccc;}</style>
</head>
<body><div id="container"><div id="header"></div><div id="main"><div id="aside1" class="aside"></div><div id="content"></div><div id="aside2" class="aside"></div></div><div id="botton"></div></div>
</body>
</html>

三行三列式布局效果图如下:

第二种布局样式:css四行三列布局

代码如下:

<!DOCTYPE html>
<html>
<head><title>css四行三列布局</title><style type="text/css">*{margin: 0;padding: 0;}#container{margin: 0 auto;width: 1000px;height: 600px;	}#header{/*头部*/height: 100px;background-color: #fc9;margin-bottom: 5px;}#nav{/*导航栏*/height: 30px;background-color: rgb(0,0,255);margin-bottom: 5px;}#main{/*主体*/width: 1000px;height: 500px;margin-bottom: 5px;}.aside{        /*这部使用class属性设置相同的属性,aside1,2中只需要设置不同的属性即可*/float: left;width: 150px;height: 500px;}#aside1{/*若不使用class属性同时设置相同属性可在每个id中单独设置*//*float: left;width: 150px;height: 500px;*/background-color: #fc9;margin-right: 5px;}#content{float: left;width: 690px;height: 500px;background-color: #ccc;}#aside2{/*若不使用class属性同时设置相同属性可在每个id中单独设置*//*float: left;width: 150px;height: 500px;*/background-color: #fc9;margin-left: 5px;}#botton{/*尾部*/height: 60px;background-color: #ccc;}</style>
</head>
<body><div id="container"><div id="header"></div><div id="nav"></div><div id="main"><div id="aside1" class="aside"></div><div id="content"></div><div id="aside2" class="aside"></div></div><div id="botton"></div></div>
</body>
</html>

四行三列式布局较上一个多了导航栏:

布局样式效果图如下:

 

http://www.lryc.cn/news/2419119.html

相关文章:

  • 手撸设计模式之-委派模式
  • AI大模型基础入门(非常详细)零基础入门到精通,收藏这一篇就够了
  • c# ToolStrip控件图片和文字显示
  • 湘西新建110KV变电工程初步设计
  • 嵌入式Linux学习记录之Uboot
  • 低通和带通信号的简单理解及 Matlab 实现
  • 无线网络的加密方式:WEP、WPA和WPA2
  • 交换机的基本设置
  • 早期星际十大人物(学生时代,星际时代)
  • JavaScript window 、Document 、Location、History、Navigator,页面刷新方式汇总
  • java打包zip并下载_Java批量下载文件并zip打包
  • 常量和常量表达式
  • 替代联阳IT6564方案|CapstoneCS5262替代IT6564设计DP转HDMI+VGA扩展坞方案|Capstone CS5262设计参考
  • 网站打开速度慢的原因,排查方法及优化方法(大全)
  • 浪潮集团数据中台建设方案(WORD)
  • 简单易懂DFS(一) dfs + 回溯
  • 使用ensp模拟器中的路由器配置vrrp详解
  • 海思3518E开发笔记1.2——海思SDK脚本学习
  • Hibernate笔记
  • 启动应用程序出现wsock32.dll找不到问题解决
  • 用Sygate实现单网卡共享上网
  • AlertDialog详解
  • Android终端系统APP应用性能测试之响应速度流畅度
  • EasyCamera--更简单更灵活的相机应用编写
  • 轻量级网络IP扫描器WatchYourLAN
  • 如何组建局域网?
  • 新手iso系统怎么安装 新手安装iso镜像文件详细步骤
  • IDEA使用教程汇总
  • 自学前端第二十四天:Animation动画栈帧效果
  • win2008 r2 安装sqlserver 2000问题的解决方法